Using regex in QTP to match diff URL

I am running same QTP script in QA and Staging environment. One test case requires me to click on a PDF document which opens in a new window. My situation is that the even though the document is the same the domain name is different. What do I do to match it. Can I use regular expression to do it?

URL of document in QA:

http://qaapp2/InfoLibrary/ViewDocument\.aspx\?documentid=81b60525-9393-45ac-9c89-2fb1b0cb4701&documentname=ICD10\+physician\+readiness\+survey\.pdf"

URL of document in Staging:

http://stgapp2:81/InfoLibrary/ViewDocument\.aspx\?documentid=81b60525-9393-45ac-9c89-2fb1b0cb4701&documentname=ICD10\+physician\+readiness\+survey\.pdf"

If you look at the URL, you would notice that everything is the same except the domain name

QA: qaapp2 
STG: stgapp2:81

Only common string sequence is 'app2'

I am unable to successfully match the using regex, I used this

[(stg)|(qa)][app2]

and it is not working. Please help.

Upvotes: 1

Views: 295

Answers (1)

vins
vins

Reputation: 15400

Change the regular expression to

((stg)|(qa))app2

I use below site to verify my regex pattern.

http://www.regular-expressions.info/vbscriptexample.html

Note: Works only in IE as it is VBScript.

Upvotes: 1

Related Questions