Hi all,
Using Excel 2013.
Trying to get the pattern to return all letters in a string
My test string is "asdf134!#@$adsf]"
My current pattern is "[a-zA-Z]*"
So the result should be "asdfadsf"
But my pattern stops when 1 is encountered so the output is "asdf"
How can I get the pattern to continue through the entire string?
thx
w
Sub:
Function![]()
Sub foo() Dim t As String Dim s As String s = "asdf134!#@$adsf]" t = TestRE(s) Debug.Print t End Sub
![]()
Function TestRE(s As String) As String Dim regex As New RegExp Dim colregmatch As MatchCollection With regex .Pattern = "[a-zA-Z]*" .MultiLine = False .Global = True .IgnoreCase = False End With Set colregmatch = regex.Execute(s) TestRE = colregmatch(0) End Function











LinkBack URL
About LinkBacks
Register To Reply
Bookmarks