All Products
Search
Document Center

Resource Orchestration Service:Fn::MatchPattern

Last Updated:Mar 15, 2024

The built-in function Fn::MatchPattern checks whether a value of the String type matches the condition in a regular expression. If the value matches the condition, true is returned. Otherwise, false is returned.

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. This parameter specifies a regular expression that is of the String type.

  • value: Required. This parameter specifies the value that you want to use to match the condition in the specified regular expression.

Return value

true or false.

Examples

  • Fn::MatchPattern:
     - '[a-z]+'
     - adb

    In this example, true is returned.

  • Fn::MatchPattern:
     - '[a-z]+'
     - 12b

    In this example, false is returned.