Home Search

DriveWorks Pro 22
IsMatch

Send Feedback

IsMatch

Indicates whether the regular expression specified finds a match in the input string.

Syntax

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.

Examples

#RuleMeaning
1IsMatch("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.
2IsMatch(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.
  • (^|[\s/;\(\)]) - Matches either the start of the string OR one of: a white space character "\s", a forward slash, a semi-colon ";", an opening parenthesis "\(", or a closing parenthesis "\)".
  • Safari - Matches the string Safari within the input string.
  • [\s/;\(\)] - Matches either, a white space character, a forward slash, a semi-colon, an opening parenthesis, or a closing parenthesis.

Example Outcomes for Example #1

InputPatternOutcome
"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

Example Outcomes for Example #2

Outcome of DWCurrentClientDetailsPatternOutcome
"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

Regular expressions are grouped within parentheses (). The following table lists some of the more common regular expressions and gives their meaning.

Regular ExpressionDescription
^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".
\sThe "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