Home » Basics

Defining Regular Expressions

28 October 2009 1,316 views No Comment

Before start writing the main post, I would like to tell you first that in QTP, you can use regular expressions only for values of type string.

In QTP, you can define a regular expression for a constant value, a Data Table parameter value, an Environment parameter value, or a property value in a programmatic description.

You can define a regular expression by entering the regular expression syntax for the string in the Value box in the Constant Value Options dialog box or the Parameter Options dialog box. You instruct QTP to treat the value as a regular expression by selecting the Regular Expression check box.

All programmatic description property values are automatically treated as regular expressions.

By default, QTP treats all characters in a regular expression literally, except for the period (.), hyphen (-), asterisk (*), caret (^), brackets ([ ]), parentheses (()), dollar sign ($), vertical line (|), plus sign (+), question mark (?), and backslash (\). When one of these special characters is preceded by a backslash (\), QTP treats it as a literal character.

If you enter a special character in the Value box of the Constant Value Options or the Parameter Options dialog box, QTP asks you if you want to add a backslash (\) before each special character. If you click Yes, a backslash (\) is added before the special character to instruct QTP to treat the character literally. If you click No, QTP treats the special character as a regular expression character.

Popularity: 12% [?]

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.