Regex #
Definitions for Regex api
@[reducible, inline]
Equations
- Regex.ValidPos s = { pos : String.Pos // String.Pos.Valid s pos }
Instances For
Equations
- Regex.instSubstringValid s = { default := ⟨s.val.startPos, ⋯⟩ }
Equations
- Regex.instCoeStringValidSubstring = { coe := fun (s : String) => ⟨s.toSubstring, ⋯⟩ }
@[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 full match and capture groups for a single match in s
.
- fullMatch : Match
the full match
the capture groups, empty groups can arise, for example, in alternatives
- isSubstringOf : self.fullMatch.val.str = s
fullMatch
is a substring ofs
. - areSubstringsOf : (self.groups.all fun (x : Option Match) => Option.all (fun (x : Match) => decide (x.val.str = s)) x) = true
all matches in
groups
are substrings ofs
.
Instances For
theorem
Regex.start_pos_valid_of
{s : ValidSubstring}
(captures : Captures s.val.str)
:
String.Pos.Valid s.val.str captures.fullMatch.val.startPos
theorem
Regex.stop_pos_valid_of
{s : ValidSubstring}
(captures : Captures s.val.str)
:
String.Pos.Valid s.val.str captures.fullMatch.val.stopPos