You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many languages use / to indicate the start and end of a regular expression, and thus require any forward slashes within the pattern to be escaped as \/.
ripgrep does not need to explicitly delimit regexes, and does not treat / as special. But sometimes habit leads me to mistakenly type \/ anyway. This produces an error:
Fair enough. But given ripgrep's status as an interactive tool, it would be nice if it would just Do What I Mean, perhaps warning about the unnecessary escape but then proceeding, rather than making me go back and edit the command.
I tested various other regular expression APIs and tools that don't use / as a delimiter: Python re, PCRE, GNU grep, and BSD grep on macOS. All of these accepted \/ (with no warning) and treated it as /. (Most of those seemed to allow unnecessary backslash escapes of arbitrary characters; Python allowed it for characters other than letters and numbers. Personally I'd prefer a more conservative approach that only allows it for /.)
The text was updated successfully, but these errors were encountered:
Describe your feature request
Many languages use
/
to indicate the start and end of a regular expression, and thus require any forward slashes within the pattern to be escaped as\/
.ripgrep does not need to explicitly delimit regexes, and does not treat
/
as special. But sometimes habit leads me to mistakenly type\/
anyway. This produces an error:Fair enough. But given ripgrep's status as an interactive tool, it would be nice if it would just Do What I Mean, perhaps warning about the unnecessary escape but then proceeding, rather than making me go back and edit the command.
I tested various other regular expression APIs and tools that don't use
/
as a delimiter: Pythonre
, PCRE, GNU grep, and BSD grep on macOS. All of these accepted\/
(with no warning) and treated it as/
. (Most of those seemed to allow unnecessary backslash escapes of arbitrary characters; Python allowed it for characters other than letters and numbers. Personally I'd prefer a more conservative approach that only allows it for/
.)The text was updated successfully, but these errors were encountered: