Is it possible to search a string that is a regex, without escaping all the fancy characters?
For example, I want to find this string in my source file: ^[\d\| *]$, without escaping \, $, etc.
I would like to just copy and paste the regex and get the result.
What you want is a grep that searches for matching strings, rather than attempting to match a regular expression. With GNU grep, you can invoke the command with the
-F or –fixed-strings flags, or just invoke the command as fgrep instead. The following are all equivalent:
Fixed-string searches are exactly what you need when you want to match code that represents a regular expression, or when you want a faster grep that doesn’t need the advanced matching capability of a regular expression engine.