in reply to Re^2: Elegant way to escape a string in a regex
in thread Elegant way to escape a string in a regex

In single-quoted string literals (e.g. «q{}»), only «\» and the delimiter(s) (i.e. «{» and «}» when using «q{}») are significant. You may need to escape instances of the former, while instances of the latter needs to be escaped or balanced. Finally, you must not escape anything except the aforementioned characters.