My Problem
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.
What have I tried
- Search the manual
- Escape the regex chars (works, but error-prone)
My Question
How can I instruct ag to treat the search term as a literal string, instead of a regex pattern?
--literal
/-Q
? – Fabien\Q
and\E
like this\QApplication(service)\E
and as I knowag
tool uses PCRE based engine so it should work most likely, though not sure as never used that tool. – Ordure