i'm trying allow users register username, long doesn't have special characters (e.g. $£*%&) or numbers in it.
i have made following works, won't allow non-english characters. is, if put in text विकिपी matches not being alphabetical character not want.
[^a-za-z0-9'-]+$ i want allow users type in username in whatever alphabet want. use english alphabet or hindi or chinese etc. should check string existence of numbers , non-alphabetic characters.
is there kind of regex range match special characters?
clarification: need check username (string) entered form numbers , non-alphabet characters in order flag invalid. regex needs @ string , if matches number or special-character server throw error. flagging them errors, i'm telling user use characters in alphabet of chosen language.
in coldfusion(java) can check input using unicode property well:
\\p{isalphabetic} \\p{isalphabetic} matches unicode non-letter.
examples:
boolean = "विकिपीडिया".matches(".*?\\p{isalphabetic}.*"); // false boolean b = "विकिपीडिया7".matches(".*?\\p{isalphabetic}.*"); // true boolean c = "-विकिपीडिया".matches(".*?\\p{isalphabetic}.*"); // true
Comments
Post a Comment