Expand description
Lua pattern matching engine — a faithful port of lstrlib.c’s matcher. Pure functions over byte slices (stone candidate: no runtime types).
Structs§
- Match
- A successful match against a Lua pattern, with the captures it produced.
- PatError
- Error returned by the pattern matcher (malformed pattern, runaway depth,
invalid
%ffrontier, etc.).
Enums§
- Cap
- One capture produced by a successful pattern match.
Functions§
- anchor_
split - Split a leading
^anchor from the pattern body. The caller decides what the anchor means (find/match scan at most once; gsub/gmatch stop after the first position). - find
- Scan from
initfor the first match (PUC str_find_aux without the plain fast path). A leading^anchors the search toinit. - has_
specials - Whether the pattern contains any pattern-special character (gsub/find fast path).
- match_
at - Try to match
pat_body(already^-stripped) at exactly positions, with no forward scan. Returns the Match (whosestart == s) or None. - plain_
find - Plain substring search (find with plain=true).