I am new to regular expressons. This first example of a regular expression does work as intended
But this one is supposed to reduce multiple spaces to one space, and doesn't work:
I've clearly not grasped the structure of this. All advice welcome.
Mark
HTML:
Function onlynumbers(ByVal ref As String)
Dim rx As Object
Set rx = CreateObject("VBScript.RegExp")
With rx
.Pattern = "\D"
.Global = True
onlynumbers = .Replace(ref, " ")
End With
End Function
But this one is supposed to reduce multiple spaces to one space, and doesn't work:
HTML:
Function test(ByVal ref As String)
Dim rx As Object
Set rx = CreateObject("VBScript.RegExp")
With rx
.Pattern = "(\S+)\x20{2,}(?=\S+)"
.Global = True
End With
End Function
I've clearly not grasped the structure of this. All advice welcome.
Mark