Atom

text.match()

Returns the first PCRE2 match and capturing groups.

Signature

text.match(value, pattern)

Parameters

Subject text and UTF-8 regex pattern text. Requires regex support.

Returns

Array of strings/nulls starting with the full match, or null for no match.

Behavior

Unicode properties enabled. An unmatched optional capture is null.

Errors

Bad regex or match resource/complexity limit.

Example

Atom
use text
m = text.match('id=42', '([0-9]+)')
assert(m[1] == '42')