手机号:^[1][3,4,5,6,7,8,9][0-9]{9}$
座机号码:^[0][1-9]{2,3}-[0-9]{5,10}$(带区号)
^[1-9]{1}[0-9]{5,8}$(不带区号)
8到20位、数字字母:^[0-9a-zA-Z]{8,20}$
数字、字母、/:^[A-Za-z0-9/]+$
数字、字母、汉字:^[0-9a-zA-Zu4e00-u9fa5]{2,10}$
匹配中文字符的正则表达式: [u4e00-u9fa5]
匹配双字节字符(包括汉字在内):[^x00-xff]
注:可以用来计算字符串的长度(一个双字节字符长度计2,ASCII字符计1)
判断数字:
"^\d+$" //非负整数(正整数 + 0) "^[0-9]*[1-9][0-9]*$" //正整数 "^((-\d+)|(0+))$" //非正整数(负整数 + 0) "^-[0-9]*[1-9][0-9]*$" //负整数 "^-?\d+$" //整数 "^\d+(\.\d+)?$" //非负浮点数(正浮点数 + 0) "^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$" //正浮点数 "^((-\d+(\.\d+)?)|(0+(\.0+)?))$" //非正浮点数(负浮点数 + 0) "^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$" //负浮点数 "^(-?\d+)(\.\d+)?$" //浮点数