Hi, I Have my pierce of code that is not working properly.I need the strSearch(the input string) string to be able to be matched to the strSearchptn (the pattern the text to conform to).However my code when i press the Command0 button it doesn't incrememnt the "regExp_Matches.Count " it is showing 0,
Can someone maybe locate where the problem is
NB** all the data is just test data I need to have it working to put the actual data
The code is below
Private Sub Command0_Click()
Dim regExp As Object
Dim strSearchPtn As String
Dim strSearchText As String
Dim strMatchingSeq As String
Dim myCount As Integer
strSearchPtn = "[0-9]"
strSearchText = "2018"
strMatchingSeq = "The Sequence is Matched" 'test variable
Set regExp = CreateObject("vbscript.regexp")
With regExp
.Pattern = strSearchPtn
.IgnoreCase = True
.Global = True
End With
Set regExp_Matches = regExp.Execute(strSearchText)
myCount = regExp_Matches.Count 'test variable
If regExp_Matches.Count = 1 Then
Me.txtTextBox = strMatchingSeq
Else
Me.txtTextBox = "Nothing Found"
End If
End Sub