matches
Checks whether a given regex pattern matches entirely with the search string.
matches(searchString, regex)Parameters#
searchString: Thestringto search withinregex: The regular expression pattern to match withsearchString
Returns#
- A boolean
trueonly if the regex matches with the entire string and not a part of it.
Examples#
assertTrue(matches('Your account is locked, call us at 10902 55555 for your options.', '(?i)[a-z\\s]+account[a-z\\s]+locked[a-z\\s\\S]+\\d{5}\\s\\d[5][a-z\\s\\S]+'))info
Read our notes on regular expression to learn about the regex pattern rules.