matches
Checks whether a given regex pattern matches entirely with the search string
.
matches(searchString, regex)
#
ParameterssearchString
: Thestring
to search withinregex
: The regular expression pattern to match withsearchString
#
Returns- A boolean
true
only if the regex matches with the entire string and not a part of it.
#
ExamplesassertTrue(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.