Expand description
Substring → glob → regex pattern promotion, shared by every tool option that accepts a pattern.
The rule lets a caller write the simplest thing that expresses intent and have the tool infer how literally it was meant:
- a string with no metacharacters is a
Literalsubstring (regex-escaped, matched verbatim); - a string with only glob metacharacters (
*,?,[ … ]) that is not a valid regex is aGlob, converted to an equivalent regex; - anything else carrying regex metacharacters and forming a valid expression
is a
Regex, used exactly as written.
Enums§
- Pattern
Kind - How a raw pattern string was interpreted by
classify.
Functions§
- classify
- Classify a raw pattern according to the suite’s promotion rule.
- compile
- Compile a pattern for content / unanchored matching (e.g.
ct-search --grepor anyct-testmatcher): the result matches anywhere in the haystack. - compile_
anchored - Compile a pattern for whole-name matching: anchored to the full string, so
*.javameans “the name ends in.java”, not merely “contains”. - compile_
name_ set - Compile a
'|'-separated set of whole-name alternatives, each promoted and anchored. An entry name matches the set when it matches any alternative, mirroringfind’s-name a -o -name b. - glob_
to_ regex - Convert a glob pattern into an (unanchored) regular-expression source.
- promote
- Produce the regex source a raw pattern promotes to, without anchoring.