Match
A single matched span within a string.
Match values are returned by indexing a Captures.
Coercing one with str produces the matched text.
Fields
end @ Int[get]The byte offset of the end of the match within the haystack.
Example
Open in playgroundlet date = Regex r"(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})" let Captures(caps) = date.match "prefix 2024-03-15 suffix" let Match(year) = caps["year"] echo $year # => 2024 echo $year.start # => 7 echo $year.end # => 11start @ Int[get]The byte offset of the start of the match within the haystack.