The Regexp data type

The data type of regular expressions is Regexp. By default, Regexp matches any regular expression value. If you are looking for a type that matches strings which match arbitrary regular expressions, see the Pattern type. You can use parameters to restrict which values Regexp matches.

Parameters

The full signature for Regexp is:

Regexp[<SPECIFIC REGULAR EXPRESSION>]
The parameter is optional.
PositionParameterData typeDefault valueDescription
1Specific regular expressionRegexpnoneIf specified, this results in a data type that only matches one specific regular expression value. Specifying a parameter here doesn’t have a practical use.

Examples:

  • Regexp

    Matches any regular expression.

  • Regexp[/<regex>/]

    Matches the regular expression /<regex>/ only.

Regexp matches only literal regular expression values. Don't confuse it with the abstract Pattern data type, which uses a regular expression to match a limited set of String values.