In regex is there a way to escape special characters in an entire region of text in PCRE syntax?
eg. hey+Im+A+Single+Word+Including+The+Pluses+And.Dots
Normally to match the exact string in regex I would have to escape every single +
and .
with /
s in the above string. This means that if the string is a variable, One has to seek for special characters and escape them manually. Is there an easier way to do this by telling regex escape all special characters in a block of text?
The motivation behind this is to append this to a larger regex so even though there are easier ways to get exact matches they don't apply here.