Escapes special characters in a string to create a valid regular expression pattern.
The string to escape.
Optional. Specifies whether to escape the string if it is invalid RegExp. Default is true.
If the string is not a valid regexp and escape is set to false, will return undefined
Escapes special characters in a string to create a valid regular expression pattern.