常用正则表达式
匹配中文字符的正则表达式: /[\u4e00-\u9fa5]/
匹配双字节字符(包括汉字在内):/[^\x00-\xff]/
匹配空行的正则表达式:/\n[\s| ]\r/
匹配HTML标记的正则表达式:/<(.)>.</\1>|<(.) />/
匹配首尾空格的正则表达式:(^\s*)|(\s*KaTeX parse error: Undefined control sequence: \d at position 18: …匹配IP地址的正则表达式:/(\̲d̲+)\.(\d+)\.(\d+…/
正整数:/1[1-9][0-9]KaTeX parse error: Undefined control sequence: \d at position 13: / 非正整数:/^((-\̲d̲+)|(0+))/
负整数:/^-[0-9][1-9][0-9]KaTeX parse error: Undefined control sequence: \d at position 14: / 必须是正整数:/^-?\̲d̲+/
非负浮点数:/^\d+(.\d+)?KaTeX parse error: Can't use function '\.' in math mode at position 17: … 正浮点数:/^((0-9)+\̲.̲[0-9]*[1-9][0-9…/
非正浮点数:/^((-\d+.\d+)?)|(0+(.0+)?))
/
负
浮
点
数
:
/
(
−
(
(
正
浮
点
数
正
则
式
)
)
)
/ 负浮点数:/^(-((正浮点数正则式)))
/负浮点数:/(−((正浮点数正则式)))/
英文字符串:/2+
/
英
文
大
写
字
符
串
:
/
[
A
−
Z
]
+
/ 英文大写字符串:/^[A-Z]+
/英文大写字符串:/[A−Z]+/
英文小写字符串:/3+
/
英
文
字
符
数
字
串
:
/
[
A
−
Z
a
−
z
0
−
9
]
+
/ 英文字符数字串:/^[A-Za-z0-9]+
/英文字符数字串:/[A−Za−z0−9]+/
英文数字加下划线串:/^\w+KaTeX parse error: Undefined control sequence: \w at position 11: / 邮箱地址:/^[\̲w̲-]+(\.[\w-]+)*@…/
URL:/4+://(\w+(-\w+))(.(\w+(-\w+)))(?\s)?KaTeX parse error: Undefined control sequence: \/ at position 13: / OR:/^http:\̲/̲\/[A-Za-z0-9]+\…/
邮编:/5\d{5}KaTeX parse error: Can't use function '\u' in math mode at position 9: / 中文:/^[\̲u̲0391-\uFFE5]+/
电话:/^(((\d{2,3}))|(\d{3}-))?((0\d{2,3})|0\d{2,3}-)?[1-9]\d{6,7}(-\d{1,4})?KaTeX parse error: Can't use function '\(' in math mode at position 12: / 手机号码:/^((\̲(̲\d{2,3}\))|(\d{…/
双字节字符(包括汉字在内):/6/
匹配空行:/\n[\s| ]*\r/
电话区号:/^0\d{2,3}
/
腾
讯
Q
Q
号
:
[
1
−
9
]
∗
[
1
−
9
]
[
0
−
9
]
∗
/ 腾讯QQ号:^[1-9]*[1-9][0-9]*
/腾讯QQ号:[1−9]∗[1−9][0−9]∗
帐号(字母开头,允许5-16字节,允许字母数字下划线):7[a-zA-Z0-9_]{4,15}$
中文、英文、数字及下划线:/8+$/