String.match

String.match

String.match

Function

Returns a string or regular expression match result.

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
patternString/RegexNo''The string or regular expression to match.

Return value

TypeDescription
Array/EmptyIf string pattern matching is successful, an array containing needle will be returned; if the regular pattern does not have the g flag, a capture group array will be returned; if the regular pattern has the g flag, all matching text will be returned; if there is no match, Empty will be returned.

Example

Notes

  • When there is no g flag in the regular expression, the 0th item is a complete match, and subsequent items are capturing groups; the missing capturing group is Null.