Micro Focus QTP (UFT) Forums
How to Use regular Expressions - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Regular Expressions (https://www.learnqtp.com/forums/Forum-UFT-QTP-Regular-Expressions)
+--- Thread: How to Use regular Expressions (/Thread-How-to-Use-regular-Expressions)



How to Use regular Expressions - srinivasadityab - 10-03-2008

Hi

I need help in using regular expressions. I am practicing QTP and gone through some practice exercises given in the book. I am a bit confused with regular expressions. My book says that

* matches zero to any number of occurrences of the preceding character

. Matches any single character

I use regular expression on the Fax order on the sample flight application in QTP 8.2. I go to Flight app. File->Open Order. Give the order no.3 and click OK. In the flights menu bar I click file->fax order

Now I change the Fax order no: to 7 in the recorded script and the test fails. I insert a standard checkpoint on the title bar of FAX order no like this Fax order no.* and it doesn't work.

How do I insert a regular expression here. tried [0-9]+. Still not working

Any help please

Regards
Srinivas


RE: How to Use regular Expressions - kishoreinchennai - 10-03-2008

Can you paste the Code

Regards


RE: How to Use regular Expressions - srinivasadityab - 10-04-2008

Hi
Below is the Code I have recorded.In the 6th Step ((WinEdit("Edit").Set "3"), I change the value 3 to 7 and Run it. The test will obviously fail as in the 12th step I insert a check point for "Send Signature with order" which will look for the Order no.3 in the title bar. I was asked to use a regular expression to handle the order no. in the title bar of the fax screen. I right clicked on the title bar in the active screen and tried to use the above regular expressions. But they are not working. I would like to know the exact syntax for the regular expression in the title bar

Code:
Window("Flight Reservation").Activate
Window("Flight Reservation").Activate
Window("Flight Reservation").WinMenu("Menu").Select "File;Open Order..."
Window("Flight Reservation").Dialog("Open Order").Activate
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "3"
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
Window("Flight Reservation").Activate
Window("Flight Reservation").Activate
Window("Flight Reservation").WinMenu("Menu").Select "File;Fax Order..."
Window("Flight Reservation").Dialog("Fax Order No. 3").Activate
Window("Flight Reservation").Dialog("Fax Order No. 3").WinCheckBox("Send Signature with order").Check CheckPoint("Send Signature with order")
Window("Flight Reservation").Dialog("Fax Order No. 3").WinButton("Cancel").Click
Window("Flight Reservation").WinButton("Button").Click



RE: How to Use regular Expressions - Ankur - 10-04-2008

what you see here
Code:
Dialog("Fax Order No. 3")
is simply a view, changing values here won't matter, actual object identification happens in the Object repository(OR). Go to the corresponding OR change the value to regexpression of your choice and then test. It should work.

Also next time please put the formatted code.


RE: How to Use regular Expressions - srinivasadityab - 10-05-2008

Hi Ankur

Thanks for your reply. I went object repository and changed the constant value to a regular expression. But Still I have problems while running the test and the object is not recognized.
I started a new thread that will bring more clarity for what I am asking (Contains a jpeg image too). Please help me


RE: How to Use regular Expressions - srinivasadityab - 10-05-2008

The new Thread is titled "Using regular expression" posted on 10/04/2008