I need to search for filename AM*GQ, where * is sequence eg 344
Can i do this vbs?
Thanks in advace!!
I need to search for filename AM*GQ, where * is sequence eg 344
Can i do this vbs?
Thanks in advace!!
Regular Expressions should work.
pattern = "[A][M][0-9]*[C][Q].*"
string = "AM432CQ.txt"
MsgBox RegExTest(pattern,string)
Function RegExTest(pattern, strng)
Dim regEx, Match, Matches ' Create variable.
Set regEx = New RegExp ' Create a regular expression.
regEx.Pattern = pattern ' Set pattern.
regEx.IgnoreCase = True ' Set case insensitivity.
regEx.Global = True ' Set global applicability.
Set Matches = regEx.Execute(strng) ' Execute search.
For Each Match in Matches ' Iterate Matches collection.
RetStr = RetStr & "Match found at position "
RetStr = RetStr & Match.FirstIndex & ". Match Value is '"
RetStr = RetStr & Match.Value & "'." & vbCRLF
Next
RegExTest = RetStr
End Function