toPattern

Converts a glob-style pattern (using * and ? wildcards) to a regex pattern string.

Extension property on String. * becomes .* and ? becomes .. Every other character matches itself, with the regex metacharacters \ ^ $ . | + ( ) [ ] { } escaped.