Skip to content
FutureBlitz

    Install

    Import std.text.regex

    Match

    std.text.regex

    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)

    std/text/regex.fb, line 96

    • Public ReadOnly Field Text: String field #

      The text the match is in.

    • Public Property Start: Int property #

      Where it starts.

    • Public Property Finish: Int property #

      Where it finishes, just past its last byte.

    • Public Property Value: String property #

      The text it matched.

    • Public Property GroupCount: Int property #

      How many groups the pattern has, not counting the whole match.

    • @PanicsAtCaller Operator [](number: Int): String? operator #

      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.

    • @PanicsAtCaller Operator [](name: String): String? operator #

      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.

    • @PanicsAtCaller Public Method StartOf(number: Int): Int? method #

      Where group number starts, or Null when it took no part. Panics unless the pattern has that group.

    • @PanicsAtCaller Public Method StartOf(name: String): Int? method #

      Where the group called name starts, or Null when it took no part. Panics unless the pattern has a group of that name.

    • @PanicsAtCaller Public Method FinishOf(number: Int): Int? method #

      Where group number finishes, or Null when it took no part. Panics unless the pattern has that group.

    • @PanicsAtCaller Public Method FinishOf(name: String): Int? method #

      Where the group called name finishes, or Null when it took no part. Panics unless the pattern has a group of that name.

    • Public Method ToString(): String method #

      The text it matched, as Value gives it.

    Report an issue with this page or with FutureBlitz on GitHub.