Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Substitute: add support for $& $` $' $_ and \b \v #491

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

NWilson
Copy link
Contributor

@NWilson NWilson commented Sep 23, 2024

The $& replacement, and $` and $' are common sequences for $0, and "left of $0" / "right of $0" respectively. Perl supports these, so PCRE2 surely should.

The $_ is less common but supported by some engines.


Finally, very very minor:

The \b escape is supported by Perl, so we should add it too.

The \v escape is there for completeness - it's not apparently supported by Perl, but many other dialects such as JavaScript or .NET use this C-inspired escape sequence for "vertical tab". It's obviously not possible to support this in patterns, but in the replacement string I can't see a reason not support it.

Copy link
Collaborator

@zherczeg zherczeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants