I am trying to validate a user input for special characters using regular expression here is what i ave tried
Function IsValidName(strData As String) As Boolean
Dim RE As Object, REMatches As Object
Set RE = CreateObject("vbscript.regexp")
With RE
.MultiLine = False
.Global = True
.IgnoreCase = True
.Pattern = "[^a-zA-Z0-9]"
End With
IsValidName = Not RE.Test(strData)
End Function
- this works fine for English
- but when user enters some text in Chinese or Japanese alphabetic then this function fails.
Edit above solution worked for alphanumeric input but when user enters some Chinese or Japanese characters this function fails and returns false.
I solved this problem by putting all special characters in an array and checked user input for existence of special characters
this was the most simple solution I could think of and it worked ..