Indicates whether the regular expression specified finds a match in the input string.
IsMatch([Input],[Pattern])
Where:
Input is the input string to find the regular expression within.
Pattern is the regular expression to be used to find a match.
# | Rule | Meaning |
---|---|---|
1 | IsMatch("0000000000000001", "0*[1-9][0-9]*") | This function uses the Regular Expression pattern "0*[1-9][0-9]*" to search for a match within the input string "0000000000000001" that matches the pattern. This returns true as the input string matches the pattern specified. |
2 | IsMatch(DWCurrentClientDetails,"(^|[\s/;\(\)])Safari[\s/;\(\)]") | This function uses the Regular Expression pattern "(^|[\s/;\(\)])Safari[\s/;\(\)]" to search for a match within the input string DWCurrentClientDetails that matches the pattern.
|
Input | Pattern | Outcome |
---|---|---|
"0000000000000001" | "0*[1-9][0-9]*" | True |
"000000" | "0*[1-9][0-9]*" | False |
"00759" | "0*[1-9][0-9]*" | True |
"123456789" | "[^0-9]" | False |
"123854" | "0*[1-9][0-9]*" | True |
"123def789" | "[^0-9]" | False |
"abcdefghi" | "[^0-9]" | True |
"asdfgs" | "0*[1-9][0-9]*" | False |
Outcome of DWCurrentClientDetails | Pattern | Outcome |
---|---|---|
"Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25" | "(^|[\s/;\(\)])Safari[\s/;\(\)]" | True |
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; da-dk) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1" | "(^|[\s/;\(\)])Safari[\s/;\(\)]" | True |
"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/4.0; InfoPath.2; SV1; .NET CLR 2.0.50727; WOW64)" | "(^|[\s/;\(\)])Safari[\s/;\(\)]" | False |
Regular expressions are grouped within parentheses (). The following table lists some of the more common regular expressions and gives their meaning.
Regular Expression | Description |
---|---|
^ | The "hat"/caret/circumflex character means "the beginning of the string". |
$ | A dollar sign "$" means the end of the string. |
| | The | pipe bar character means "or". |
[] | Square brackets are used to provide a choice of characters, they effectively mean "one of the characters between my opening and closing bracket". |
\s | The "backslash s" is used to denote a space (whitespace) within a string. |
\( or \) | To search for a parenthesis, within a string, a backslash is required at the start. This is because parentheses in regular expressions are special characters used for grouping. |
For more information on regular expressions please see the MSDN article - Character Classes in Regular Expressions