in reply to string escaping / de-escaping functions
That being said, many useful things are already written more than once. Unfortunately they are often already written more than once in ways which do you little good for your specific problem. The most general and simplest answer to your query seems to be the narrowly named but broadly general Text::EscapeDelimiters which will escape more than delimiters. There is also the corresponding Text::DelimMatch for retrieving delimited text.
String::Escape does what you are asking and more but only in certain narrow cases. Unfortunately, those cases do not include your example specification. You can add escaping methods to it, but then you'd have to write them.
Encode::Escape wraps up several different types of escaping into one module.
URI::Escape works well with URLs and URIs.
Regexp::Common has many tasty treats in its namespace, including Regexp::Common::delimited.
|
|---|