Below is the list of all meta characters in QTP.
\ - indicates that the next character would be a special character, a literal or a backreference
^ - Input String should be matched at the beginning.
$ - Input String should be matched at the end.
* - Matches the preceding character zero or more times. It is same as {0,}.
+ - Matches the preceding character one or more times. It is same as {1,}.
? - Matches the preceding character zero or one time. It is same as {0,1}
{i} - Matches the previous character exactly i times.
{i,} - Matches the previous character at least i times and at most any time.
{i,j} -Matches the previous character at least i times and at the most j times.
. - Matches any single character except "\n".
(pattern) - Matches pattern and captures the match that can be used in backreferences.
p|q - Matches either p or q. Please note that p and q could be more complex regular expressions
[pqr] - A character set. Matches any one of the character inside the brackets.
[^pqr] - A negative character set. Matches any character not inside the brackets.
[p-z] - A range of characters. Matches any character in the specified range i.e p,q,r,....x,y,z.
[^p-z] - A negative range characters. Matches any character not in the specified range i.e. a,b,c...m,n,o
\b - Matches the boundary of the word
\B - Matches middle part of the word.
\d - Matches a digit character. same as [0-9].
\D - Matches a nondigit character. same as [^0-9].
\f , \n and \r - Matches a form-feed character, newline and carriage character.
\s - Matches any white space character including space, tab, form-feed. Equivalent to [ \f\n\r\t\v].
\S - Matches any non-white space character. Equivalent to [^ \f\n\r\t\v].
\t , \v - Matches a horizontal and vertical tab character.
\w - Matches alpha numeric character including underscore. Equivalent to '[A-Za-z0-9_]'.
\W - Matches any non - alpha numeric character. Equivalent to '[^A-Za-z0-9_]'.
\number- A reference back to captured matches.
**********************************************************************************
**********************************************************************************
Some examples on regular expressions:
You may also like below topics on regular expressions in QTP.
Please give your inputs, suggestions, feedback to Us about above QTP topic. We value your thoughts.
\ - indicates that the next character would be a special character, a literal or a backreference
^ - Input String should be matched at the beginning.
$ - Input String should be matched at the end.
* - Matches the preceding character zero or more times. It is same as {0,}.
+ - Matches the preceding character one or more times. It is same as {1,}.
? - Matches the preceding character zero or one time. It is same as {0,1}
{i} - Matches the previous character exactly i times.
{i,} - Matches the previous character at least i times and at most any time.
{i,j} -Matches the previous character at least i times and at the most j times.
. - Matches any single character except "\n".
(pattern) - Matches pattern and captures the match that can be used in backreferences.
p|q - Matches either p or q. Please note that p and q could be more complex regular expressions
[pqr] - A character set. Matches any one of the character inside the brackets.
[^pqr] - A negative character set. Matches any character not inside the brackets.
[p-z] - A range of characters. Matches any character in the specified range i.e p,q,r,....x,y,z.
[^p-z] - A negative range characters. Matches any character not in the specified range i.e. a,b,c...m,n,o
\b - Matches the boundary of the word
\B - Matches middle part of the word.
\d - Matches a digit character. same as [0-9].
\D - Matches a nondigit character. same as [^0-9].
\f , \n and \r - Matches a form-feed character, newline and carriage character.
\s - Matches any white space character including space, tab, form-feed. Equivalent to [ \f\n\r\t\v].
\S - Matches any non-white space character. Equivalent to [^ \f\n\r\t\v].
\t , \v - Matches a horizontal and vertical tab character.
\w - Matches alpha numeric character including underscore. Equivalent to '[A-Za-z0-9_]'.
\W - Matches any non - alpha numeric character. Equivalent to '[^A-Za-z0-9_]'.
\number- A reference back to captured matches.
**********************************************************************************
**********************************************************************************
Some examples on regular expressions:
- To match the 10 digit mobile number -> \d{10}
- To match email address -> \w+@\w+\.\w+
You may also like below topics on regular expressions in QTP.
Please give your inputs, suggestions, feedback to Us about above QTP topic. We value your thoughts.
No comments:
Post a Comment
Please Leave your reply. We value your feedback and inputs