Skip to main content

Module pattern

Module pattern 

Source
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 Literal substring (regex-escaped, matched verbatim);
  • a string with only glob metacharacters (*, ?, [ … ]) that is not a valid regex is a Glob, converted to an equivalent regex;
  • anything else carrying regex metacharacters and forming a valid expression is a Regex, used exactly as written.

Enums§

Mode
An explicit --mode choice that switches promotion off for every pattern argument in an invocation: the stated interpretation is used as-is.
PatternKind
How a raw pattern string was interpreted by classify.

Functions§

classify
Classify a raw pattern according to the suite’s promotion rule.
classify_with
classify under an optional explicit mode: a stated Mode pins the kind; absent, promotion decides.
compile
Compile a pattern for content / unanchored matching (e.g. ct-search --grep or any ct-test matcher): the result matches anywhere in the haystack.
compile_anchored
Compile a pattern for whole-name matching: anchored to the full string, so *.java means “the name ends in .java”, not merely “contains”.
compile_anchored_with
compile_anchored under an optional explicit mode.
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, mirroring find’s -name a -o -name b.
compile_name_set_with
compile_name_set under an optional explicit mode. With a stated mode of literal, the '|' separator is still a set separator (the alternatives themselves are matched verbatim).
compile_with
compile under an optional explicit mode.
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.
promote_with
promote under an optional explicit mode.