Writing ( and ) in a regex doesn’t work

What about this regex?

\('(.*)'\)

You need to escape ( and ) since those are reserved in Regex. So every time you encounter a ( or a ) which you want to evaluate as a literal, you need to escape them.

Leave a Comment