RegexMatch

Category: Script / Strings
Since engine version: 8.0 OC

Description

Performs a regular expression match, returning an array of arrays containing [full match, submatch 1, submatch 2, etc.].

Syntax

array RegexMatch(string text, string regex, int flags);

Parameters

text:
String to match.
regex:
Regular expression in ECMAScript syntax.
flags:
Bitmask of the following values:
Constant Description
Regex_CaseInsensitive Regular expression is case insensitive.
Regex_FirstOnly Stop after first match, returning an array with zero or one elements.

Example

Log("%v", RegexMatch("OC 8.0", "(\\w+)\\s(\\d+)\\.(\\d+)"));
Parses a version string, printing [["OC 8.0", "OC", "8", "0"]].
See also: RegexReplace, RegexSearch, RegexSplit
Luchs, 2016-09