Lyricdev
GitHub

struct Match

pub struct Match :: [Equatable, Debug]

Conforms to Equatable, Debug, Display.

A match: where it is in the text (byte offsets), its text, and its groups — group 0 the whole, a group that took no part null.

Fields

pub start: int
pub end: int
pub value: string

The matched text.

Methods

pub fn group(i: int): ?string

Returns the text of group i; null where it took no part or there is no such group.

pub fn span(i: int): ?(int, int)

Returns where group i is, start and end as byte offsets; null where it took no part or there is no such group.

pub fn named(name: string): ?string

Returns the text of the group named name; null where it took no part or there is no such name.

pub fn groups(): int

Returns how many groups there are, the whole match counted.

fn show(): string