1, a regular expression, only contains Chinese characters, numbers, letters, underscores can not be underlined at the beginning and end: ^ (?!) _)(?!. *?_$) [a-za-z0-9_\u4e00-\u9fa5]+$ Where: ^ matches the place where the string begins (?! _) cannot begin with _ (?!. *?_$) can not end with _ [a-za-z0-9_\u4e00-\u9fa5]+ at least one Chinese character, number, letter, underscore $ and the end of the string match place in front of the program plus @, otherwise need \ \ to escape @ ^ (?! _)(?!. *?_$) [a-za-z0-9_\u4e00-\u9fa5]+$] [or: @] ^ (?! _) \w* (? <!_) $ "or @" ^[\u4e00-\u9fa50-9a-za-z_]+$ ") 2, only contains Chinese characters, numbers, letters, underscores, underline position is not limited to: ^[a-za-z0-9_\u4e00-\u9fa5]+$ 3, by the number
Words, 26 English letters or underscores of the string ^\w+$ 4, 2~4 a kanji @ "^[\u4e00-\u9fa5]{2,4}$"; 5, ^[\w-]+ (\.[ \w-]+) *@[\w-]+ (\.[ \w-]+) +$: (ABC) + to analyze: XYZAbcAbcAbcXYZAbcAb xyzabcabcabcxyzabcab 6, [^\u4e00-\u9fa50-9a-za-z_] 34555#5 '-->34555#5 ' [\u4e00-\u9fa50-9a-za-z_] eiieng_89_---> eiieng_89_ _ '; Eiieng_88&*9_--> _ '; ' eiieng_88&*9_ _ '; ' Eiieng_88_&*9_--> _ '; '
eiieng_88_&*9_ public bool Regexname (string str) {bool Flag=regex.ismatch (str,@ "^[a-za-z0-9_\u4e00-\u9fa5]+$");
return flag;
} Regex reg=new Regex ("^[a-za-z_0-9]+$"); if (Reg. IsMatch (s)) {\ \ conform to rule} else
{\ \ exists an illegal character}
This is all in this article, and I hope it helps to learn about JavaScript regular expressions.