pub(crate) fn glob_to_regex(glob: &str) -> StringExpand description
Convert a glob pattern to an equivalent regex string.
Escapes regex-special characters and translates glob wildcards:
*becomes.*?becomes.[...]character classes are passed through (with!or^mapped to^)- All other regex metacharacters are escaped with a backslash.
- The result is anchored with
^...$.
§Examples
"*.cpp"→"^.*\.cpp$""test?"→"^test.$""*cmake"→"^.*cmake$""[!a-z]*"→"^[^a-z].*$"
Used by --glob to convert the search pattern and by --glob-exclude (-i)
to convert the exclude pattern.