Regex #
Main api for Regex
Regex.build
: build a Regex from the given patternRegex.captures
: searches for the first match of the regexRegex.all_captures
: searches all successive non-overlapping matches of the regex
@[reducible, inline]
Represents a single match of a regex in a haystack.
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Represents the capture groups for a single match.
- fullMatch : Regex.Match
the full match
- groups : Array (Option Regex.Match)
the capture groups
Instances For
Instances For
Instances For
def
Regex.build
(s : String)
(flavor : Syntax.Flavor := default)
(flags : Syntax.Flags := default)
(config : Compiler.Config := default)
(extended : Regex.Grammar.ExtendedKind := Regex.Grammar.ExtendedKind.None)
:
Build a Regex from the given pattern.
Equations
- Regex.build s flavor flags config extended = do let nfa ← Syntax.AstItems.parse s flavor extended >>= Syntax.translate flags >>= Compiler.compile config Except.ok { nfa := nfa }
Instances For
This routine searches for the first match of this regex in the haystack given, returns an array of log msgs, the overall match and the matches of each capture group
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns an array of log msgs and all successive non-overlapping matches in the given haystack.
Equations
- Regex.Log.all_captures s re logEnabled = Regex.Log.all_captures_loop s { byteIdx := 0 } re logEnabled (#[], #[])
Instances For
This routine searches for the first match of this regex in the haystack given, and if found, returns not only the overall match but also the matches of each capture group in the regex. If no match is found, then None is returned.
Equations
- Regex.captures s re «at» = match Regex.Log.captures s re «at» false with | (fst, captures) => captures
Instances For
Returns all successive non-overlapping matches in the given haystack.
Equations
- Regex.all_captures s re = match Regex.Log.all_captures s re false with | (fst, captures) => captures