Escape regular expression characters

regex:escape(STRING str
, STRING delimiter: "/")

regex:escape('[$]@#')
#=> "\\[\\\$\\]@#"

# warning: if you use a delimiter other than `/` in your regex, you must specify it in the second argument. e.g.
regex:match?('~i'. regex:escape('[','~') .'~', 'hi')
#=> FALSE

Copyright ©2013-2022 SunSed®. All rights reserved.