matches

array matches(value, regex)

Returns the result of matching a value against a regular expression.

An array value will return the result of the first matching element, a dictionary value will return the result of the first matching key, otherwise the value itself is matched.

Flags embedded as a prefix in regex:

FlagDescription
(?d)Unix lines mode
(?i)Case-insensitive matching (US-ASCII only)
(?iu)Case-insensitive matching (Unicode, preferred)
(?m)Multiline mode
(?s)Dotall mode
(?u)Unicode-aware case folding
(?x)Ignore whitespace and comments in pattern

Parameters

  1. value — value to be matched.
  2. regexregular expression to match against.

Returns