A structure representing the capture groups from a regex match.
Contains the original string (haystack) and a buffer of positions marking the start and end of each capture group.
- haystack : String
- buffer : Array (Option String.Pos)
Instances For
Equations
- Regex.instReprCapturedGroups = { reprPrec := Regex.reprCapturedGroups✝ }
Gets a specific capture group as a substring.
self
: The captured groupsindex
: The index of the capture group to retrieve (0 for the entire match)- Returns: An optional substring representing the capture group, or
none
if the group didn't participate in the match
Equations
- One or more equations did not get rendered due to their size.
Instances For
Converts all capture groups to an array of optional substrings.
self
: The captured groups- Returns: An array where each element is either a substring for a capture group
or
none
if that group didn't participate in the match
Equations
- self.toArray = Regex.CapturedGroups.toArray.go self 0 #[]
Instances For
@[irreducible]
def
Regex.CapturedGroups.toArray.go
(self : CapturedGroups)
(i : Nat)
(accum : Array (Option Substring))
:
Equations
Instances For
A structure that enables iterating through all capture groups of regex matches in a string.
Provides a stateful iterator for finding all regex matches and their capture groups in a haystack string.
- regex : Regex
- haystack : String
- currentPos : String.Pos
Instances For
Equations
- Regex.instReprCaptures = { reprPrec := Regex.reprCaptures✝ }
Gets the next match and its capture groups.
self
: The captures iterator- Returns: An optional pair containing the captured groups and an updated iterator,
or
none
if no more matches are found
Equations
- One or more equations did not get rendered due to their size.
Instances For
Gets the number of remaining characters to process in the haystack string.
self
: The captures iterator- Returns: The number of remaining positions
Instances For
theorem
Regex.Captures.lt_next?_some
{groups : CapturedGroups}
{m m' : Captures}
(h : m.next? = some (groups, m'))
: