Scripting > UNICOM Intelligence Function Library > Text functions > RegExTest
 
RegExTest
Returns true if the Val string matches the supplied regular expression.
Syntax
RegexTest (Val, RegexExpression [, IgnoreCase])
Parameters
Val
Type: Text
The text to be validated.
RegExExpression
Type: Text
The regular expression.
IgnoreCase
Type: Boolean
Optional. The default value is False.
Remarks
ICU string types are not currently supported. For more information, see “Working With Unicode and ICU String Types”:
http://boost.sourceforge.net/libs/regex/doc/icu_strings.html
Example
The following mrScriptBasic example uses the RegexTest function to validate email addresses in a text variable:
emailAddress.RegexTest("^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$")
The following example can be used for validating US postal codes:
postCode.RegexTest("^[0-9]{5}(?:-[0-9]{4})?$")
The following example can be used for validating UK postal codes:
postCode.RegexTest("^[A-Z]{1,2}[0-9R][0-9A-Z]? [0-9][ABD-HJLNP-UW-Z]{2}$")
See also
Text functions