I have a text area which should accept only alphanumeric characters.
Currently I have a validation function (as shown in the attached) which returns either true or false.
Based on the return value, it will print a message. (Valid or Invalid)
Now the requirement is, Instead of validating the entered characters I should stop them while entering them. I guess I need to use regular expressions but no idea how to implement this.
Could anybody please guide me if you have a solution.
dim regExp, match, i, spec
For i = 1 to Len(stritem)
spec = Mid(stritem, i, 1)
Set regExp = New RegExp
regExp.Global = True
regExp.IgnoreCase = True
regExp.Pattern = "[A-Z]|[a-z]|[0-9]"
set match = regExp.Execute(spec)
If match.count = 0 then
IsAlphaNumeric = False
Set regExp = Nothing
IsAlphaNumeric = True