Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with regular expression Please Assist
#1
Not Solved
Hi,

I have encountered an issue, where in I am working with Regular Expression.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

Request you to kindly give a solution to this using reg expression only.


Thanks in advance.


Regards,
Ras
Reply


Messages In This Thread
Need help with regular expression Please Assist - by RA185112 - 02-02-2013, 11:07 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need Any digit in xpath path using Regular expression Priyam 1 3,519 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,390 04-09-2015, 01:56 AM
Last Post: sarahq49
  Regular expression and script optimisation Padmavathy 1 3,854 03-30-2015, 11:46 AM
Last Post: supputuri
  Regular expression in descriptive programming testernc 1 16,631 12-08-2014, 06:38 PM
Last Post: anshika.agarwal
  need a regular expression. anu05446 0 3,140 11-26-2014, 03:00 PM
Last Post: anu05446

Forum Jump:


Users browsing this thread: 3 Guest(s)