QTP/UFT Support Tip: How to use regular expressions
Some users may need to identify objects with dynamic property values. How can QTP or UFT identify such objects without changing the test identification properties each time the value changes?
To do this, the user can implement regular expressions, which is a string of special characters that define conditions for specific characters search. A more specific definition as provided by Microsoft: "A regular expression is a pattern that the regular expression engine attempts to match in input text. A pattern consists of one or more character literals, operators, or constructs."
The following regular expression options seem to be very popular for QTP object identification:
backslash (\) - Instructs QTP to treat the next character as either a special character if it is otherwise an ordinary character, or a literal character, if it is otherwise a special character.
period (.) - Instructs QTP to search for any single character.
brackets () - Instructs QTP to search for any single character within a list of characters, not in a list (when used with the caret), or within a range (when used with a hyphen "-").
caret (^) - Instructs QTP to match the expression only at the start of a line, or after a newline character. When used with brackets, instructs QuickTest to search for a character not in the specified list.
asterisk (*) - Instructs QTP to match zero or more occurrences of the preceding character.
plus sign ( + ) - Instructs QTP to match one or more occurrences of the preceding character.
question mark (?) - Instructs QTP to match zero or one occurrences of the preceding character.
parentheses (()) - Instructs QTP to treat the contained sequence as a unit, just as in mathematics and programming languages.
dollar sign ($) - Instructs QTP to match the expression only at the end of a line, or before a newline character.
vertical line (|) - Instructs QTP to match one of a choice of expressions.
For more information on the usage of regular expressions please refer to the following links:
Regular Expression Language - Quick Reference (MSDN): http://msdn.microsoft.com/en-us/library/az24scfc.aspx
How to use regular expressions (or wildcards): http://support.openview.hp.com/selfsolve/document/KM205585
[If this post or any other post helps to resolve your issue or query, mark the thread as solved and give KUDOS to the author for their assistance. ]
(Posts and opinions made here are my own and do not reflect the opinions of my employer HP in any way)