UFT-vbScript- I am reading a getROproperty of a link from an application.And the link has 300 different values following similar class pattern for many links like [PDF LLC- USA , [PDF MMB CANADA ,[PDF MCCS AUSTRALIA ,[PDF SSC MEXICO. [PDF ACCS MEXICO My question here is I just want to display the country name removing the other associated strings .How will I achieve this progamatically using vbscript. one way of doing this is using SPLIT fxn , but the real question is how will one know which pattern to choose from .
Asked
Active
Viewed 71 times
1 Answers
0
You should always post a sample code which you have tried along with your question.
If there is always a space (" ") just before your country name, use space to split up like the below
strExtractedValue = "[PDF LLC- USA"
arrExtract = Split(strExtractedValue , " ")
strCountryName = arrExtract(2) ' the 3rd element

Mithilesh Indurkar
- 481
- 1
- 5
- 12
-
Thanks Mithilesh .With the help of RegExp and Split function I was able to get the desired output. set oRegExp= new RegExp oRegExp.global= True oRegexp.Ignorecase = True oRegexp.Pattern=".PDF SMC -" bMatch =oRegExp.Test(x) If bMatch = TRUE Then temp = split(x,"[PDF SMC - ") 'msgbox (temp(0)) Print(temp(1)) End If – Satyendra Tripathi Jul 24 '17 at 13:13