Dr. Demento
Well-known Member
- Joined
- Nov 2, 2010
- Messages
- 618
- Office Version
- 2019
- 2016
- Platform
- Windows
I'm looking for some assistance in a UDF to remove punctuation. Since I'm keeping diacritics, I can't use the usual [^A-Za-a0-9 ]. Looking at ASCII, I came up with the UDF below, but it doesn't work (at all).
Thoughts?? Thanks y'all.
Thoughts?? Thanks y'all.
Code:
Function remove_punctII(rts As String) As String
With CreateObject("vbscript.regexp")
.Global = True
.IgnoreCase = True
.Pattern = "^[\x21-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]"
remove_punctII = CStr(.Replace(rts, vbNullString))
End With
End Function