term is a generic sanitizer for strings that match (if
outcome is true)
or strings that don’t match (if
outcome is false).
Specifically, whitelisting regexps such as
^(foo|bar)$ sanitize matches in the true case.
Inverted character classes such as
\W sanitize matches in the false case.