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
Request you to kindly give a solution to this using reg expression only.
Thanks in advance.
Regards,
Ras
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