Fn::MatchPattern checks whether a string value matches a regular expression and returns true or false.
Declaration
-
JSON
{ "Fn::MatchPattern": [ pattern, value ] } -
YAML
-
Syntax for the full function name:
Fn::MatchPattern: pattern, value -
Syntax for the short form:
!MatchPattern [pattern, value]
-
Parameters
-
pattern: Required. A regular expression of the String type. -
value: Required. The string value to match against the regular expression.
Return value
true or false.
Examples
Fn::MatchPattern: - '[a-z]+' - adbtrueis returned.Fn::MatchPattern: - '[a-z]+' - 12bfalseis returned.