Skip to content

API Reference / @gtkx/runtime / matchAllRegex

Function: matchAllRegex() ​

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

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

Scans for all possible matches of a compiled GRegex in the subject string using the DFA algorithm, including overlapping matches, 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 matches.