Regular Expression in VTAP
Regular expressions enable VTAP to verify the object property. Regular Expressions increase the flexibility and adaptability of tests.
Regular expressions can also be used in VTAP verification actions.
A regular expression is a string that provides a complex search phrase. It contains a set of special characters using which you can define the conditions of search. The special characters may be period (.), asterisk (*), caret (^), brackets ([ ]), parentheses (()), dollar sign ($), vertical line (|), plus sign (+), question mark (?) and backslash (\).
The table below helps you to define expressions for the PatternMatch operator to input values for the Verify Property action and set the search criteria.
Note: In the Enter Values dialog box, select PatternMatch from the Operator listbox and enter the required expression in the Expected value Text box. For example, ^New.
Regular Expressions | Description | Examples |
^ | Matches the beginning of the input | ^gift |
$ | Matches the end of the input | e$ |
* | Matches the preceding character zero or more times | Go*gle Search |
+ | Matches the preceding character one or more times | Go+gle Search |
? | Matches the preceding character zero or one time | G?ogle Search |
. | Matches any single character except a new line character | T.String |
x|y | Matches either x or y. (Character|Character) | x|y |
{n} | n is a nonnegative integer. Matches exactly n times. | Go[2]gle (matches only two o's ) |
{n,} | N is nonnegative integer. Matches at least n times. | Go[2,]gle (matches at least two o's ) |
{n,m} | N is nonnegative integer. Matches at least n and at most m times. | Go[1.2]gle (matches o's first two times) |
[xyz] | A character set. Matches any one of the enclosed characters. | Go[xyz]gle (matches x,y,z) |
[^xyz] | A negative character set. Matches any character not enclosed. | Go[^p]gle (does not match p) |
[a-z] | A range of characters. Matches any character in the specified range. | Go[a-z]gle (within the range a - z ) |
[^m-z] | A negative range characters. Matches any character not in the specified range. | Go[^a-z]gle (not within the range a - z ) |
\d | Matches a digit character. Equivalent to [0-9]. | Testing/d1 (matches a digit 0 - 9) |
\D | Matches a non-digit character. Equivalent to [^0-9]. | Testing/D (matches a non-digit 0 - 9) |
\s | Matches any white space | Google/sSearch (matches for white space) |
\w | Matches any word character including underscore. Equivalent to "[A-Z a-z 0-9_]". | Software/wTesting (matches for alphanumeric Charecters) |