-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Can't escape '$' in --replace text #1524
Labels
doc
An issue with or an improvement to documentation.
Comments
It can be escaped. Use It should be documented in the help text for the |
Didn't think about that, thank you for the quick response and ripgrep itself. |
BurntSushi
added a commit
that referenced
this issue
May 8, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of ripgrep are you using?
ripgrep 12.0.0
-SIMD -AVX (compiled)
+SIMD +AVX (runtime)
What operating system are you using ripgrep on?
Windows 10
Describe your question, feature request, or bug.
When using ripgrep's --replace option, '$' can't be used in the replacement text, because it is interpreted as the name of a capture group and cannot be escaped:
rg -iIN 'test([^:_$])' -r '$replacement_text$$1'
outputs$1
instead of e.g.$replacement_text$!
Trying to escape the '$' does not work either:
rg -iIN 'test([^:_$])' -r '\$replacement_text\$$1'
yields\\$1
instead.The text was updated successfully, but these errors were encountered: