Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Very interesting issue with regular expression Please Help Me :)
#4
Not Solved
Hi,

I have encountered an issue, where in I am working on string.So need help.

String is str1 = "abcrrera 0200******011" , I am trying to use regular exp as the numbers in the string may change.

what is the Patrn that we need to pass?As i have written the code, however i think i am unable to handle "*" spl character in the above string.


Here is the function that i have written. However i am unable to get the pattern? Need help
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.

I tried creating a new post, however i am not sure, i dont have permissions , so i am using the relevant tread.

Regards,
Ras
Reply


Messages In This Thread
RE: Very interesting issue with regular expression Please Help Me :) - by RA185112 - 02-01-2013, 01:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need Any digit in xpath path using Regular expression Priyam 1 3,263 10-05-2016, 11:05 AM
Last Post: Ankur
  Regular expression to read two words in lowercase, uppercase and with and without spa sarahq49 1 3,211 04-09-2015, 01:56 AM
Last Post: sarahq49
  Regular expression and script optimisation Padmavathy 1 3,616 03-30-2015, 11:46 AM
Last Post: supputuri
  Regular expression in descriptive programming testernc 1 16,401 12-08-2014, 06:38 PM
Last Post: anshika.agarwal
  need a regular expression. anu05446 0 3,029 11-26-2014, 03:00 PM
Last Post: anu05446

Forum Jump:


Users browsing this thread: 1 Guest(s)