Translate a string for use in a regular expression. This might include either wildcard replacement or special character escaping. The behavior can be controlled by the op that can have the values
- "wildcard"
- The wildcard characters
.
,*
and?
are replaced with wildcards that are appropriate for a regular expression.- "escape"
- The characters
$.?[]
, that have special meaning for regular expressions are escaped so that they are treated literally.