Fn::MatchPattern

更新时间:
复制 MD 格式

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]+'
     - adb

    true is returned.

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

    false is returned.