Created
July 11, 2013 05:06
-
-
Save brazilnut2000/5972654 to your computer and use it in GitHub Desktop.
VBA: Remove list of characters from a string using Regex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function RemoveInvalidCharacters(cleanMe As String) As String | |
Dim objRegex As Object | |
Set objRegex = CreateObject("vbscript.regexp") | |
With objRegex | |
.Global = True | |
.Pattern = "[\<\>\*\'\,\$\#\@\.\""\?\!\/\[\]\:\|\\\/\?|]" | |
RemoveInvalidCharacters = .Replace(cleanMe, "") | |
End With | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment