The online community for software testing & quality assurance professionals
 
 
Calendar   Today's Topics
Sponsors:




Lost Password?

Home
BetaSoft
Blogs
Jobs
Training
News
Links
Downloads



Testing Tools >> Micro Focus/Compuware TestPartner

Pages: 1
Venkat_Paladugu
Newbie


Reged: 03/21/08
Posts: 16
Using Regular Expression
      #716734 - 09/20/12 12:16 AM

Hi,
I have one scenario to click/verify the object having the Name "RamaKrishna1234" and the name is getting changed at runtime as "RamaKri12345".

For this I want to use regular expressions,but the code which I got from googgling is not working ..


Please help me


Post Extras: Print Post   Remind Me!   Notify Moderator  
GregEncke
Member


Reged: 02/11/08
Posts: 277
Loc: Seattle, WA
Re: Using Regular Expression [Re: Venkat_Paladugu]
      #716768 - 09/20/12 09:16 AM

Try this regEx.Pattern = "^RamaKri\d{5}$"

--------------------
Patience is like bread I say.... I ran out of that yesterday.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Venkat_Paladugu
Newbie


Reged: 03/21/08
Posts: 16
Re: Using Regular Expression [Re: GregEncke]
      #717406 - 10/03/12 07:01 AM

Hi,

Thanks for your response.

Can you provide the complete code for creating regexp object .


Thanks!!


Post Extras: Print Post   Remind Me!   Notify Moderator  
GregEncke
Member


Reged: 02/11/08
Posts: 277
Loc: Seattle, WA
Re: Using Regular Expression [Re: Venkat_Paladugu]
      #717414 - 10/03/12 08:11 AM

I work with QTP, but you could try something like this

Set regEx = New RegExp
regEx.Pattern = "^RamaKri\d{5}$"
regEx.Global = true

Edited by GregEncke (10/03/12 08:25 AM)


Post Extras: Print Post   Remind Me!   Notify Moderator  
Ozone
Newbie


Reged: 06/08/12
Posts: 13
Re: Using Regular Expression [Re: GregEncke]
      #717423 - 10/03/12 11:41 AM

You must add a reference in TestPartner to 'Microsoft VBScript Regular Expressions 5.5'

Open \Tools\References...

The code below only works after you create the reference.
VBA does not have the regular expression object in it.

Dim subjectString As String
Dim myRegExp As RegExp
Dim myMatches As MatchCollection
Dim myMatch As Match
Set myRegExp = New RegExp
myRegExp.IgnoreCase = True
myRegExp.Global = True
myRegExp.Pattern = "^RamaKri\d{5}$"
subjectString = "RamaKri12345"

Set myMatches = myRegExp.Execute(subjectString)
For Each myMatch In myMatches
TestLog.Comment (myMatch.Value)
Next


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 3 anonymous users are browsing this forum.

Moderator:  Myrtle, Jim Brennan, AJ, DSquared 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 2332

Rate this topic

Jump to

Contact Us | Privacy statement SQAForums

Powered by UBB.threads™ 6.5.5