Match

Contains match data for a combination of a regex and a subject.

class ref Match

Constructors

_create

Store a match, a subject, and a size.

new ref _create(
  subject: (String val | Array[U8 val] val),
  m: Pointer[_Match val] ref)
: Match ref^

Parameters

Returns


Public Functions

size

Returns the capture size of the match.

fun box size()
: U32 val

Returns


start_pos

Returns the character position of the first character in the match.

fun box start_pos()
: USize val

Returns


end_pos

Returns the character position of the last character in the match.

fun box end_pos()
: USize val

Returns


apply[optional A: ((String iso | Array[U8 val] iso) & Seq[U8 val] iso)]

Returns a capture by number. Raises an error if the index is out of bounds.

fun box apply[optional A: ((String iso | Array[U8 val] iso) & Seq[U8 val] iso)](
  i: U32 val)
: A^ ?

Parameters

Returns

  • A^ ?

find[optional A: ((String iso | Array[U8 val] iso) & Seq[U8 val] iso)]

Returns a capture by name. Raises an error if the named capture does not exist.

fun box find[optional A: ((String iso | Array[U8 val] iso) & Seq[U8 val] iso)](
  name: String box)
: A^ ?

Parameters

Returns

  • A^ ?

groups

Returns all of the captured subgroups. Groups that failed to capture anything will contain the empty string.

fun box groups()
: Array[String val] iso^

Returns


dispose

Free the underlying PCRE2 data.

fun ref dispose()
: None val

Returns


Private Functions

_final

Free the underlying PCRE2 data.

fun box _final()
: None val

Returns