HI, I need to make a function in ASP and regular expressions that would accept data only in A-Z, a-z, 0-9 only. Like: function db(data){ 'I need the coding here.... } Code (markup): Plz help me thanx
This doesnt use regex but it will filter the characters function OnlyAZ123(data) as boolean 'heres the characters it can contain CharsToMatch ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" x=0 'assume its ok til we look at the characters CharsOK=True for x = 1 to len(data) 'check them one at a time if instr(CharsToMatch,mid(data,x,1)) = 0 then CharsOK=False exit for end if next return CharsOK end function
So, in this list "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" can I add other characters as well? Like, CharsToMatch ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\^/+_" or will it not work if i add those special chars?? Thanx
Hello, U can us following regular Expressions dim RExp : set RExp = new RegExp with RExp .Pattern = "^([0-9a-zA-Z])$" .IgnoreCase = True .Global = True end with Code (markup):
you can add other characters to the ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 list