Skip to content

API Reference / @gtkx/runtime / matchRegex

Function: matchRegex() ​

matchRegex<MatchInfo>(regex, subject, startPosition, matchOptions): [boolean, MatchInfo]

Defined in: packages/runtime/dist/regex.d.ts:11

Scans for a match of a compiled GRegex in the subject string, keeping the subject's bytes alive so the returned match info's fetch methods stay valid for as long as it is reachable.

Type Parameters ​

MatchInfo ​

MatchInfo extends object

Parameters ​

regex ​

object

The compiled regex to scan with.

subject ​

string | string[]

The string to scan for matches.

startPosition ​

number

Starting index of the subject to match, in bytes.

matchOptions ​

number

Match options to apply.

Returns ​

[boolean, MatchInfo]

Whether the subject matched, and the match info describing the match.