Import std.text.regex
Match
class
Public Class Match Implements Printable
One match of a Regex in Text: where it starts and finishes, and its groups' text, group 0 being the whole match.
Examples
Local found = Try Regex(r"(?<user>\w+)@(\w+)\.com").Find("mail ada@example.com today")
Expect(found != Null)
If found == Null Then Return
Expect(found.Value == "ada@example.com" && found.GroupCount == 2)
Expect(found["user"] == "ada" && found[2] == "example" && found.StartOf(2) == 9)-
The text the match is in.
-
Where it starts.
-
Where it finishes, just past its last byte.
-
The text it matched.
-
How many groups the pattern has, not counting the whole match.
-
Group number's text, the whole match's for 0, or Null when the group took no part. Panics unless the pattern has that group.
-
The text of the group called name, or Null when it took no part. Panics unless the pattern has a group of that name. Where several have it, it's the first that took part.
-
Where group
numberstarts, or Null when it took no part. Panics unless the pattern has that group. -
Where the group called
namestarts, or Null when it took no part. Panics unless the pattern has a group of thatname. -
Where group
numberfinishes, or Null when it took no part. Panics unless the pattern has that group. -
Where the group called
namefinishes, or Null when it took no part. Panics unless the pattern has a group of thatname. -
The text it matched, as Value gives it.
Report an issue with this page or with FutureBlitz on GitHub.