Comment by cormacrelf

Comment by cormacrelf 4 hours ago

1 reply

How about -F -regexthatlookslikeaflag? Verbatim, that errors out as the command line parsing tries to interpret it as a flag. If you don’t have -F, then you can escape the leading hyphen with a backslash in a single quoted string: '\-regex…', but then you don’t get fixed string search. And -F '\-regex…' is a fixed string search for “backslash hyphen r e g e x”. The only way is to manually escape the regex and not use -F.

I think maybe a syntax like -F=-regex would work.

burntsushi 3 hours ago

Yeah, that's a good call out. You would need `rg -F -e -pattern`.