Matches
- Last Updated: August 14, 2020
- 1 minute read
- Corticon.js
- Documentation
SYNTAX
<String>.matches(regularExpression:String)<String>.matches(regularExpression:String,flags:<String>)
DESCRIPTION
Returns true if the regular expression matches the String.FLAGS
The characters
gis, when one or more
are added to the expression with no separator, represent: gglobal, replace more than first match (the default)iignore casesmatch line terminator ("newline") characters in a string, which it would not match otherwise. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/dotAll.
USAGE RESTRICTIONS
The Operators row of the table in Summary Table of Vocabulary Usage Restriction applies. No special exceptions.
This sample Rulesheet uses matches in non-conditional actions:
Action A: Determine whether a String is a valid
identifier - A String must contain an item identification with the following pattern:
- Characters 1-5: alphabetic.
- Characters 6-10: numeric.
- Character 11: alphabetic.
Action B: Check whether an email address is valid - An email address must have alphanumeric characters and certain special characters before and after an @ and a dot.
SAMPLE RULETEST
A sample Ruletest provides various valid and invalid Strings that are evaluated by the two regular expression examples.
![]()