Hi,


I am trying to compare the string "abcera 0200******01" and patrn = "abcera 
0200******01" with the following code.



Function RegExpTest(patrn ,string)


Dim regEx, Match, Matches  


       ''Create variable.


   Set regEx = New RegExp   ' Create regular expression.


   n = 0


   regEx.Pattern =patrn  ' Set pattern.


   regEx.IgnoreCase = True   ' Set case insensitivity.


   regEx.Global = True   ' Set global applicability.


   Set Matches = regEx.Execute(string)   ' Execute search.


   For Each Match in Matches   ' Iterate Matches collection.


      RetStr = RetStr & "Match found at position "


                  MSGBOX  RetStr


      RetStr = RetStr & Match.FirstIndex & ". Match Value is '"


                                  MSGBOX   RetStr


                                  RetStr = RetStr & Match.Value & "'." & 
vbCRLF


                                  MSGBOX   RetStr


          If Match.Value  = patrn  Then


                                                  msgbox patrn


                                                  msgbox  Match.Value


                                  n = n+1


                                  MSGBOX n


                                  End If


   Next


   RegExpTest = RetStr


    MSGBOX   RegExpTest


                If   n >1Then


                                                                
Reporter.ReportEvent micPass, "Card Accepted text is Added to ER Area ", 
"Match Text: is" &patrn & " Repeats " & n & " Times"


                  msgbox patrn & " repeats " & n & "times"


      Elseif n=1 Then


                  msgbox patrn & " repeats " & n & "times"


            Reporter.ReportEvent micPass, "test is present", "Match Text: 
is" &patrn & " Repeats " & n & " Times"


                                                                  msgbox 
patrn & " repeats " & n & "times"


                Else


                Reporter.ReportEvent micFail, "test is  not present", 
"unMatch Text: " & patrn & " Repeats " & n & " Times"               


                msgbox patrn & " repeats " & n & "times"                   
        


                End If


End Function




This function is not working. Request you to kindly give a solution to this 
using reg expression only.

Thanks in advance.

Regards,

Ras

-- 
-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

--- 
You received this message because you are subscribed to the Google Groups "QTP 
- HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to