codecaine icon

Remove invalid characters from string

codecaine | PRO | 05/11/18 04:07:47 PM UTC | 0 ⭐ | 1390 👁️ | Never ⏰ | []
VBScript |

390 B

|

None

|

0 👍

/

0 👎

Function RemoveInvalidCharacters(data As String) As String
'remove a character set from a string 
    Dim objRegex As Object
    Set objRegex = CreateObject("vbscript.regexp")
    With objRegex
        .Global = True
        'characters to be replaced
        .Pattern = "[\<\>\*\'\,\$\#\@\.\""\?\!\/\[\]\:\|\\\/\?|]"
        RemoveInvalidCharacters = .Replace(data, "")
    End With
End Function

Comments