I'm searching for Application(service)
in my files using ag. Since ag treats strings as regular expression patterns, I have to escape the parens and use:
ag 'Application\(service\)'
This is cumbersome and easy to miss, especially when there are multiple regex symbols in my search.
How can I instruct ag to treat the search term as a literal string, instead of a regex pattern?
The option you're looking for is
-Q --literal: Do not parse PATTERN as a regular expression. Try to match it literally.
@ https://github.com/ggreer/the_silver_searcher/blob/master/doc/ag.1.md:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With