TEXT
regexmatch
PATTERN

The regexmatch operator checks to see if the text on the left matches the regular expression on the right (see Regular Expressions).


Parameters

This operator has two parameters:

text – The text you want to match.

pattern – The regular expression.


Description

This operator checks to see if the text on the left matches the regular expression on the right (see Regular Expressions). The regexmatch operator is case insensitive (ignores the difference between upper and lower case) – if you want a case sensitive match use the regexmatchexact operator.

Entire books have been written about regular expressions (see Regular Expressions for recommendations), and you’ll probably want to read one or more of these books to get the maximum benefit from this powerful tool. Here are some very simple examples.

Does text contain a number?

    "Deadline is in 34 days" regexmatch "[0-9]+" ☞ TRUE
    "Deadline is Friday" regexmatch "[0-9]+" ☞ FALSE

Does text contain letters (and only letters and spaces) inside parentheses?

    "Bob Smith" regexmatch "\([A-z ]+\)" ☞ FALSE
    "Mary Wilson (Vice President)" regexmatch "\([A-z ]+\)" ☞ TRUE

Is the text a valid e-mail address (valid format, at least)?

    "joe@bob.com" regexmatch "^[\w!#$%&'*+/=?`{|}~^.-]+@[A-Z0-9.-]+$" ☞ TRUE
    "j oe@bob.com" regexmatch "^[\w!#$%&'*+/=?`{|}~^.-]+@[A-Z0-9.-]+$" ☞ FALSE

The final example gives you a taste of what Regular Expressions are capable of.


Error Messages

RegexMatch operands cannot be numeric. – You’ll see this message if either of the operands contains a numeric value.


See Also


History

VersionStatusNotes
10.0NewRegular expression support is new in this version