I have a set of characters:
that are considered as "reserved" and all occurrences must be escaped. How can I do that using a single
This needs to be done using a single regex, because running a
for each of the characters in the reserved set greatly reduces the performance.
escape(I | have \ a dog #)
should yield the result "I \| have \\ a dog \#".
Following @neuhaus answer: The regex is
and the replacement is