I want to get just a-z from a string and using this
Maybe that's overkill and there's a better method ?Code:Function AlphaOnly(Inval) As String Dim re As Object, REMatches As Object Set re = CreateObject("vbscript.regexp") re.Pattern = "\D+" If (re.Test(Inval) = True) Then Set REMatches = re.Execute(Inval) AlphaOnly = REMatches(0) End If Set REMatches = Nothing Set re = Nothing End Function
But also a bit intrigued, if inVal contains () why is the opening bracket also returned.