Every public name.
Generated from the packages' interfaces and their documentation. Types first, then functions and values, each in alphabetical order.
The library
Patterns, matches and the functions that drive them — the surface a caller meets.
moonregex
Types
Group
Which group a value names: Whole for the whole match, Num for a numbered parenthesis, Name for a named one.
This is the shape the methods work in. Callers do not have to build it — GroupKey is implemented by Int, by String and by this type, so m.group(1), m.group("year") and m.group(Whole) are one call.
to_group(Self) -> Self
Match
One match: where it sits in the text, and every group's span.
A span is a code-point range, so start and end read the way Python's do — characters, not UTF-16 units — and group slices the original text back out by those offsets.
after(Self) -> StringViewThe text after the match — core's
MatchResult::after.before(Self) -> StringViewThe text before the match — core's
MatchResult::before.capturesdict(Self) -> Map[String, Array[(Int32, Int32)]]Named groups to their captured spans — Python's
Match.capturesdict.content(Self) -> StringViewThe matched text — core's
MatchResult::content, and Python'sgroup(0).endpos(Self) -> Int32The
endposthe search was bounded by — Python'sMatch.endpos.expand(Self, String) -> String raise @parse.RefusedExpand the Python replacement language in
templateagainst this match — Python'sMatch.expand.fuzzy_changes(Self) -> (Array[(Int32, Int32)], Array[(Int32, Int32)], Array[(Int32, Int32)])The individual edits of a fuzzy match, as
(substitutions, insertions, deletions)each a list of(string_offset, pattern_offset); three empty lists when the pattern was not fuzzy — Python'sMatch.fuzzy_changes.fuzzy_counts(Self) -> (Int32, Int32, Int32)The edit counts of a fuzzy match, as
(substitutions, insertions, deletions); all zero when the pattern was not fuzzy — Python'sMatch.fuzzy_counts.groupdict(Self, default? : String?) -> Map[String, String]Named groups to their captured strings,
defaultfilling those that took no part — Python'sMatch.groupdict.groups(Self, default? : String?) -> Array[String?]All capturing groups (1..n) as strings,
Nonefor those that did not take part — Python'sMatch.groups.lastgroup(Self) -> String?The name of the group
lastindexpoints at, orNone— Python'sMatch.lastgroup.lastindex(Self) -> Int32?The number of the highest group that took part, or
None— Python'sMatch.lastindex.marks(Self) -> Array[String]The names of the marks
(*MARK:name)set during the match, in the order they were set — an empty list when none were.partial(Self) -> BoolWhether this match is a partial match —
regex.Match.partial. True when the pattern was compiled withpartial=true.pattern(Self) -> PatternThe
Patternthat produced this match.pos(Self) -> Int32The
posthe search started at — Python'sMatch.pos.re(Self) -> PatternThe
Patternthat produced this match — Python'sMatch.re.string(Self) -> StringThe subject text.
Pattern
A compiled pattern: the tree it came from, the flat program it became, and the source, so it can answer what Python's re answers of a Pattern — its string, its flags, how many groups, and what they are named.
add(Self, Self) -> Selfcapture(Self, String) -> Self raise @parse.RefusedThis pattern wrapped in a named capture group, as
Regex::capturein core.The group is numbered after the ones the pattern already has, and
groupindexgainsname.dialect(Self) -> @parse.DialectThe dialect the pattern was read under.
dump(Self) -> StringThe syntax tree re-printed, as Python's
Pattern.dumpwould.findall(Self, String, group? : Group, overlapped? : Bool, pos? : Int32, endpos? : Int32, limit? : Int32) -> Array[Strin…All non-overlapping matches, as
findallat the module level.finditer(Self, String, pos? : Int32, endpos? : Int32, overlapped? : Bool, limit? : Int32) -> Array[Match] raise @parse.…All matches as
Matchobjects, asfinditerat the module level.flags(Self) -> @parse.FlagsThe effective flags.
full(Self, String, pos? : Int32, endpos? : Int32, limit? : Int32) -> Match? raise @parse.RefusedMatch the whole region
pos..endpos.groupindex(Self) -> Map[String, Array[Int32]]Group name to slot, as Python's
Pattern.groupindex.groups(Self) -> Int32How many capturing groups the pattern has, group 0 not counted — Python's
Pattern.groups.lor(Self, Self) -> Selflower(Self) -> @string.Regex?The pattern as a core
@string.Regex, when the core engine can run it.The core engine speaks one grammar, so this answers only for the patterns that fit inside it: literals, classes,
.,^,$,\b,\B, groups, alternation, quantifiers up to 256. Anything else — backreferences, lookaround, conditionals, recursion, atomic groups, fuzzy matching,\X, Unicode word boundaries, Python's$— answersNone, and the pattern runs on this library's own engine instead.The result is an ordinary
@string.Regex: it can be handed to core'sexecute,find,split,replace_by, or to the lexer.partial(Self) -> BoolWhether the pattern was compiled for partial matching.
pattern(Self) -> StringThe pattern's source text.
prefix(Self, String, pos? : Int32, limit? : Int32) -> Match? raise @parse.RefusedMatch only at
pos.repeat(Self, min? : Int32, max? : Int32, greedy? : Bool) -> Self raise @parse.RefusedThis pattern repeated, as
Regex::repeatin core:mintomaxtimes, greedily unlessgreedyis off.scanner(Self, String) -> ScannerBind a
Patternto a text so its methods can scan that text incrementally.search(Self, String, pos? : Int32, endpos? : Int32, limit? : Int32) -> Match? raise @parse.RefusedScan
textfor the leftmost match.split(Self, String, maxsplit? : Int32, pos? : Int32, endpos? : Int32, limit? : Int32) -> Array[String?] raise @parse.Re…Split
texton the pattern, assplitat the module level.string(StringView) -> SelfA pattern that matches
textliterally, as@string.Regex::stringdoes.Nothing in
textis read as syntax — the caller does not have to escape it first.sub(Self, String, String, count? : Int32, pos? : Int32, endpos? : Int32, limit? : Int32) -> String raise @parse.RefusedReplace matches with
repl, assubat the module level.sub_with(Self, String, (Match) -> String raise @parse.Refused, count? : Int32, pos? : Int32, endpos? : Int32, limit? :…Replace matches with
f(match), assub_withat the module level.subf(Self, String, String, count? : Int32, pos? : Int32, endpos? : Int32, limit? : Int32) -> String raise @parse.RefusedReplace matches with
repl, asregex.subf—replis a format template whose fields name groups ({},{0},{name},{0[0]}), with an optional:spec.subfn(Self, String, String, count? : Int32, pos? : Int32, endpos? : Int32, limit? : Int32) -> (String, Int32) raise @pa…Replace matches with
repl, returning the new text and the count, asregex.subfn.subn(Self, String, String, count? : Int32, pos? : Int32, endpos? : Int32, limit? : Int32) -> (String, Int32) raise @par…Replace matches with
repl, returning the new text and the count, assubnat the module level.subn_with(Self, String, (Match) -> String raise @parse.Refused, count? : Int32, pos? : Int32, endpos? : Int32, limit? :…Replace matches with
f(match), assubn_withat the module level.
Scanner
A Scanner walks a fixed text from left to right, each call picking up where the last left off — Python's regex.Scanner, and the loop re's finditer runs internally. Build one with Pattern::scanner.
findall(Self, group? : Group, overlapped? : Bool) -> Array[String?] raise @parse.RefusedEvery remaining match from the current position, as group strings, advancing to the end of the text — Python's
Scanner.findall.finditer(Self, overlapped? : Bool) -> Array[Match] raise @parse.RefusedEvery remaining match from the current position, as
Matchobjects, advancing to the end of the text — Python'sScanner.finditer.full(Self) -> Match? raise @parse.RefusedA full match of the region from the current position, advancing past it;
Noneotherwise — Python'sScanner.full.prefix(Self) -> Match? raise @parse.RefusedA match anchored at the current position, advancing past it;
Noneif the pattern does not match there — Python'sScanner.match.search(Self) -> Match? raise @parse.RefusedThe next match from the current position, advancing past it;
Noneonce the text is exhausted — Python'sScanner.search.split(Self, maxsplit? : Int32) -> Array[String?] raise @parse.RefusedSplit the remaining text on the pattern, advancing to the end — Python's
Scanner.split.sub(Self, String, count? : Int32) -> String raise @parse.RefusedReplace every remaining match with
repl, returning the new text — Python'sScanner.sub.subn(Self, String, count? : Int32) -> (String, Int32) raise @parse.RefusedReplace every remaining match with
repl, returning the new text and advancing to the end — Python'sScanner.subn/Scanner.sub.
Functions
compile(StringView, flags? : @parse.Flags, dialect? : @parse.Dialect, lists? : Map[String, Array[String]], partial? : Bool) -> Pattern rais…Compile
patterninto aPattern.flagsanddialectset the grammar;listsfeeds\L<name>named lists;partialturns on partial matching. A pattern the grammar refuses is refused here, with where reading stopped.escape(StringView, dialect? : @parse.Dialect, special_only? : Bool, literal_spaces? : Bool) -> StringEscape
patternso the result matches it literally, underdialect.The three grammars do not agree on what needs escaping, so the same string comes back spelled three ways:
-
Python— Python'sre.escape: the characters that can mean something to the grammar are backslashed, everything else is left alone. Withspecial_onlyoff every non-alphanumeric is escaped;literal_spacesstops spaces from being escaped. -Ecma262—RegExp.escapeof ECMA-262: punctuation that is not a syntax character becomes\x.., syntax characters are backslashed, and a leading alphanumeric is spelled\x..too so the result can never read as a quantifier's neighbour. -Lexmatch— the@string.Regexgrammar: its metacharacters are backslashed and control characters are spelled in the escapes that grammar knows (\n,\t,\u{..}), never\x...findall(StringView, String, flags? : @parse.Flags, dialect? : @parse.Dialect, group? : Group, overlapped? : Bool, pos? : Int32, endpos? : I…All non-overlapping matches, as Python's
re.findall.With no group named and the pattern holding one or none, the matches (or the single group) are returned. With two or more groups and no
groupgiven, the call is ambiguous and refused — passgroupto say which to collect, or usefinditerto walkMatchobjects that carry them all.finditer(StringView, String, flags? : @parse.Flags, dialect? : @parse.Dialect, overlapped? : Bool, pos? : Int32, endpos? : Int32, limit? :…All matches as
Matchobjects, as Python'sre.finditer.full(StringView, String, flags? : @parse.Flags, dialect? : @parse.Dialect, pos? : Int32, endpos? : Int32, limit? : Int32, lists? : Map[Stri…Match the whole region
pos..endpos(Python'sre.fullmatch).prefix(StringView, String, flags? : @parse.Flags, dialect? : @parse.Dialect, pos? : Int32, limit? : Int32, lists? : Map[String, Array[Strin…Match only at
pos(Python'sre.match): fail unless the pattern matches where the scan begins, not somewhere later in the text.search(StringView, String, flags? : @parse.Flags, dialect? : @parse.Dialect, pos? : Int32, endpos? : Int32, limit? : Int32, lists? : Map[St…Scan
textfor the leftmost match, as Python'sre.search.split(StringView, String, flags? : @parse.Flags, dialect? : @parse.Dialect, maxsplit? : Int32, pos? : Int32, endpos? : Int32, limit? : Int3…Split
texton the pattern, as Python'sre.split.struct Scanner {sub(StringView, String, String, flags? : @parse.Flags, dialect? : @parse.Dialect, count? : Int32, pos? : Int32, endpos? : Int32, limit? : I…Replace matches with
repl, as Python'sre.sub.sub_with(StringView, (Match) -> String raise @parse.Refused, String, flags? : @parse.Flags, dialect? : @parse.Dialect, count? : Int32, pos?…Replace matches with the result of
f(match), as Python'sre.subwith a callable replacement.subf(StringView, String, String, flags? : @parse.Flags, dialect? : @parse.Dialect, count? : Int32, pos? : Int32, endpos? : Int32, limit? :…Replace matches with
repl, asregex.subf—replis a format template whose fields name groups ({},{0},{name},{0[0]}).subfn(StringView, String, String, flags? : @parse.Flags, dialect? : @parse.Dialect, count? : Int32, pos? : Int32, endpos? : Int32, limit? :…Replace matches with
repl, returning the new text and the count, asregex.subfn.subn(StringView, String, String, flags? : @parse.Flags, dialect? : @parse.Dialect, count? : Int32, pos? : Int32, endpos? : Int32, limit? :…Replace matches with
repl, returning the new text and how many matches were replaced, as Python'sre.subn.subn_with(StringView, (Match) -> String raise @parse.Refused, String, flags? : @parse.Flags, dialect? : @parse.Dialect, count? : Int32, pos…Replace matches with
f(match), returning the new text and the count, as Python'sre.subnwith a callable replacement.
Values
let a : @parse.Flagslet ascii : @parse.Flagsascii— Python'sre.ASCII.let b : @parse.Flagslet bestmatch : @parse.Flagsbestmatch—regex.BESTMATCH.let default_version : @parse.VersionThe version the engine reads a Python pattern under when none is asked for.
let dialect : @parse.DialectThe preset dialect: Python's
re.let dotall : @parse.Flagsdotall— Python'sre.DOTALL.let e : @parse.Flagslet ecma262 : @parse.DialectThe ECMA-262
RegExpdialect — JSON Schema and OpenAPI "string" patterns.let enhancematch : @parse.Flagsenhancematch—regex.ENHANCEMATCH.let f : @parse.Flagslet flags : @parse.FlagsThe preset flags, for callers who want to tweak one and keep the rest.
let fullcase : @parse.Flagsfullcase— Python'sre.FULLCASE.let i : @parse.Flagslet ignorecase : @parse.Flagsignorecase— Python'sre.IGNORECASE.let lexmatch_dialect : @parse.DialectThe MoonBit
lexmatchdialect —@string.Regexand the lexer.let m : @parse.Flagslet multiline : @parse.Flagsmultiline— Python'sre.MULTILINE.let p : @parse.Flagslet posix : @parse.Flagsposix—regex.POSIX.let python : @parse.DialectThe Python
redialect — the default, and the one most callers want.let r : @parse.Flagslet reverse : @parse.Flagsreverse—regex.REVERSE.let s : @parse.Flagslet u : @parse.Flagslet unicode : @parse.Flagsunicode— Python'sre.UNICODE.let v0 : @parse.Flagslet v1 : @parse.Flagslet verbose : @parse.Flagsverbose— Python'sre.VERBOSE.let version : StringThe library version, as
regex.__version__reports it.let version0 : @parse.Flagsversion0—regex.VERSION0.let version0_value : @parse.VersionThe
V0behaviour set, as aVersionvalue —regex.VERSION0's target.let version1 : @parse.Flagsversion1—regex.VERSION1.let version1_value : @parse.VersionThe
V1behaviour set, as aVersionvalue —regex.VERSION1's target.let version_info : (Int32, Int32, Int32)The library version split into
(major, minor, patch), asregex.__version_info__reports it.let w : @parse.Flagslet word : @parse.Flagsword—regex.WORD.let x : @parse.Flags
parse
One syntax tree for three grammars: Python, ECMA-262 and lexmatch.
moonregex/parse
Types
Ast
A parsed pattern: the tree, and what the parse learned about it.
flags is the compile-time flags with the pattern's own global inline flags merged in — what Pattern::flags answers.
built(Node, groups~ : Int32, groupindex~ : Map[String, Array[Int32]], flags~ : Flags) -> SelfAn
Astassembled from parts rather than parsed, so patterns can be composed in code and still be the same kind of value as a parsed one.dump(Self) -> StringThe syntax tree as text: what
Pattern::dumpanswers.Not the pattern — a parse and re-print loses spacing and comments, and folds flags into the nodes — but close enough to read a pattern back from, which is what tests and debugging want.
flags(Self) -> FlagsThe effective flags.
groupindex(Self) -> Map[String, Array[Int32]]Group name to the slots carrying it.
groups(Self) -> Int32How many capture groups the pattern has.
named_lists(Self) -> Map[String, Array[String]]The named lists the pattern declared with
\L<name>.root(Self) -> NodeThe tree on its own, for the executor.
to_lexmatch(Self) -> String?The tree as a
lexmatchpattern — what the core library's engine reads.Nonewhen the tree uses something that grammar cannot say, which is the line between the two engines: everything above it can be handed to the core library, everything below has to run here.
Flags
The switches a pattern can carry.
A record rather than a bitmask, because every one of these is a thing a reader may want to look at, set, or refuse — (?a) inside a scoped group changes what \w means for that group alone, and a bitmask cannot be asked about politely.
Flags are resolved into the syntax tree at parse time: (?s:.) puts the dotall behaviour inside the node, so the executor never consults them.
new(ignorecase? : Bool, multiline? : Bool, dotall? : Bool, verbose? : Bool, ascii? : Bool, unicode? : Bool, unicode_set…Build flags, leaving unset switches at their preset.
A flag that is only meaningful in one dialect is accepted everywhere and refused by the parser when the grammar cannot honour it —
verboseunder ECMA-262, for instance — so that the mistake is named where it happens.
Node
One node of the syntax tree every dialect is lowered into.
The tree is resolved: flags have been folded into the nodes that care ((?s:.) is an Any that eats newlines, (?i)k is a class holding both cases), so the executor never asks which grammar a node came from.
shift_slots(Self, Int32) -> SelfThe tree with every capture slot moved up by
by.Composing two patterns renumbers the right-hand one's groups so the result is numbered as one written pattern would be — the left operand keeps
1..n, the right one continues atn+1.
Functions
captured(Ast, name~ : String) -> Ast raise Refuseda.capture(name)— one more group, numbered after the ones already there.concat(Ast, Ast) -> AstOne after the other:
a + b.ecma_parse(StringView) -> Ast raise RefusedParse
patternas an ECMA-262RegExp— the grammar JSON Schema and OpenAPI mean by a "string" pattern, and what a browser handsnew RegExp.The tree is the same one Python's
rereads into; only the dialect differs, so the executor never asks which grammar a node came from.ecma_parse_with(StringView, Flags) -> Ast raise RefusedParse an ECMA-262
RegExpwith the flags already chosen by the caller.either(Ast, Ast) -> AstOne or the other:
a | b.enum Anchor {enum Cond {enum Look {enum Node {enum Recurse {enum RecurseCond {enum VerbKind {lexmatch_parse(StringView) -> Ast raise RefusedParse
patternas a MoonBitlexmatchliteral — the grammar MoonBit's own@string.Regexspeaks, the lexer uses, andlexmatchdocuments.lexmatch_parse_with(StringView, Flags) -> Ast raise RefusedParse a
lexmatchliteral with the flags already chosen by the caller.literal(StringView) -> AstAn
Astmatching exactlytext, character for character.parse(StringView, flags? : Flags, dialect? : Dialect, lists? : Map[String, Array[String]]) -> Ast raise RefusedRead a pattern into the syntax tree.
flagsare the compile-time flags; the pattern's own global inline flags are merged into them as they are met, and the merged result is whatAst::flagsanswers.repeated(Ast, min~ : Int32, max? : Int32, greedy~ : Bool) -> Ast raise Refuseda.repeat(…).struct Ast {struct FuzzySpec {
Values
let dialect : DialectThe dialect a pattern is read under when the caller does not say.
let flags : FlagsEverything off,
unicodeon, versionV0.This is the preset every default argument points at, so a pattern written with no flags at all behaves the way Python's
redoes by default.
exec
The compiled program and the backtracking engine that runs it.
moonregex/exec
Types
Program
A compiled pattern: the flat program, the sub-programs for groups and other constructs, and how many capture groups it has (group 0 not counted).
full(Self, String, pos? : Int32, endpos? : Int32, limit? : Int32) -> MatchResult? raise @parse.RefusedMatch the whole region
pos..endpos(Python'sfull).prefix(Self, String, pos? : Int32, limit? : Int32) -> MatchResult? raise @parse.RefusedMatch only at
pos(Python'smatch).search(Self, String, pos? : Int32, endpos? : Int32, limit? : Int32, must_advance? : Bool) -> MatchResult? raise @parse.…Search left to right from
postoendpos, returning the leftmost match.
Functions
compile(@parse.Ast) -> ProgramCompile a parsed pattern into the flat program.
struct MatchResult {struct Program {
prop
Code-point sets, the Unicode property lookups behind `\\p{…}`, and case folding.
moonregex/prop
Types
CharSet
A set of code points, kept as sorted disjoint inclusive ranges.
Character classes, \p{...}, \w and the rest are all this one shape, so the set algebra a pattern needs — union for [a-z], difference for --, intersection for &&, complement for [^…] — lives here once.
any() -> SelfEvery code point, surrogates included.
complement(Self) -> SelfComplement over every code point: what
[^…]means.contains(Self, Int32) -> BoolWhether a code point is in the set.
difference(Self, Self) -> SelfDifference: the V1 set algebra's
--.empty() -> SelfThe empty set.
fold(Self) -> SelfClose the set under simple case folding: add the folded form of everything in it, and the unfolded form of everything that folds into it.
This is what
(?i)does to a class at parse time: fold the pattern, not the input, so the executor stays a plain membership test. Only single code point folds exist here, soßdoes not grow anss— matching it againstSSis out of scope, exactly as it is in Python'sre.intersection(Self, Self) -> SelfIntersection: the V1 set algebra's
&&.is_empty(Self) -> BoolWhether the set holds nothing.
of(Array[(Int32, Int32)]) -> SelfBuild a set from ranges, sorting and merging them first.
The input may be in any order and may overlap; the stored form is always sorted, disjoint and coalesced, which is what makes
containsa binary search and the algebra linear.ranges(Self) -> Array[(Int32, Int32)]The stored ranges, sorted and disjoint.
single(Int32) -> SelfA set holding exactly one code point.
symmetric_difference(Self, Self) -> SelfSymmetric difference: the V1 set algebra's
~~.union(Self, Self) -> SelfUnion:
[a-z]or, in the V1 set algebra,||.
Functions
binary(StringView) -> CharSet?A binary property:
Alphabetic,White_Space,Emoji.block(StringView) -> CharSet?A block:
Basic Latin,BasicLatin,CJK Unified Ideographs.A block is one range, so the usual answer needs no walk at all; the walk is only for spellings the UCD's reader does not take.
category(StringView) -> CharSet?A general category:
L,Lu,Uppercase_Letter,casedletter.char_of_name(StringView) -> Int32?The code point a Unicode character name denotes — what
\N{name}answers from. Names are read loosely, the wayunicodedata.lookupreads them.digit() -> CharSet\d: decimal digits, and only those.fold(Char) -> CharThe simple fold of a code point; a code point with no fold is its own.
fold_pairs() -> Array[(Int32, Int32)]The fold pairs, sorted by source — what a class is closed under.
property(StringView) -> CharSet?Any property, however it is spelled — the shape
\p{...}takes.name=valueis accepted too:Script=Latin,General_Category=Lu,Block=CJK Unified Ideographs. The left side picks the table, the right side the entry; without it, every table is searched in the order a Unicode name would be looked up: category, script, block, binary property.script(StringView) -> CharSet?A script:
Latin,Latn,Han.The short code and the long name are one name to the UCD, so the name is resolved through the UCD's own reader first and only then looked up.
space() -> CharSet\s: the White_Space property.struct CharSet {version() -> StringWhich Unicode the answers follow.
word() -> CharSet\wunder the Python and mrab spellings: letters, numbers and the underscore. Python's own words for it are "alphanumeric (asstr.isalnumhas it) plus_", which is exactly these categories.
Values
let ascii_digit : CharSetlet ascii_space : CharSetlet ascii_word : CharSetThe same three, restricted to ASCII, which is what the
Aflag and the ECMA-262 dialect withoutumean by them.
glob
Shell globbing — `fnmatch`, `Glob` and `GlobSet`.
moonregex/glob
Types
Glob
A compiled glob: a pattern plus the regex it became.
compile(StringView, ignorecase? : Bool) -> Self raise @parse.RefusedCompile a path glob.
*matches a run of characters that are not separators;**matches a run that may include them (zero or more path segments);?matches one non-separator character;[...]is a character class;{a,b}is an alternation; and\escapes the next character. Both/and\are treated as separators, so Windows and POSIX paths match the same pattern.matches(Self, String) -> Bool raise @parse.RefusedWhether
pathmatches the glob, as a whole anchored match.pattern(Self) -> StringThe pattern this glob was compiled from.
GlobSet
A set of globs matched together — the workhorse behind an ignore file or a list of include patterns.
compile(Array[String], ignorecase? : Bool) -> Self raise @parse.RefusedCompile several patterns into one set.
matches(Self, String) -> Array[Int32] raise @parse.RefusedThe indices of every pattern in the set that matches
path.matches_any(Self, String) -> Bool raise @parse.RefusedWhether any pattern in the set matches
path.patterns(Self) -> Array[String]The patterns the set was compiled from, in order.
Functions
filter(Array[String], StringView, ignorecase? : Bool) -> Array[String] raise @parse.RefusedThe names that match
pat, in the order given (Python'sfnmatch.filter).filter_paths(Array[String], StringView, ignorecase? : Bool) -> Array[String] raise @parse.RefusedThe paths that match the glob
pattern, in the order given.fnmatch(String, StringView, ignorecase? : Bool) -> Bool raise @parse.RefusedWhether
namematches the shell patternpat.By default the match is case-sensitive (POSIX
fnmatch). Passignorecase=trueto fold case first, the wayfnmatchdoes on a case-insensitive filesystem.fnmatchcase(String, StringView) -> Bool raise @parse.Refusedfnmatchwithout any case folding — an exact, case-sensitive match.match_path(String, StringView, ignorecase? : Bool) -> Bool raise @parse.RefusedMatch one
pathagainst one globpattern(compiling the pattern inline).struct Glob {struct GlobSet {translate(StringView) -> StringTurn a shell/fnmatch pattern into a regex fragment (no anchors).
*and?become.*and.;[...]becomes a character class (with!or^for negation);{a,b,c}becomes an alternation; and\escapes the next character. This is thefnmatchreading, where*may cross a path separator.