[list]
[*]01、"^\\d+$" //非负整数(正整数 + 0)
[*]02、"^[0-9]*[1-9][0-9]*$" //正整数
[*]03、"^((-\\d+)|(0+))$" //非正整数(负整数 + 0)
[*]04、"^-[0-9]*[1-9][0-9]*$" //负整数
[*]05、"^-?\\d+$" //整数
[*]06、"^\\d+(\\.\\d+)?$" //非负浮点数(正浮点数 + 0)
[*]07、"^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))$" //正浮点数
[*]08、"^((-\\d+(\\.\\d+)?)|(0+(\\.0+)?))$" //非正浮点数(负浮点数 + 0)
[*]09、"^(-(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*)))$" //负浮点数
[*]10、"^(-?\\d+)(\\.\\d+)?$" //浮点数
[*]11、"^[A-Za-z]+$" //由26个英文字母组成的字符串
[*]12、"^[A-Z]+$" //由26个英文字母的大写组成的字符串
[*]13、"^[a-z]+$" //由26个英文字母的小写组成的字符串
[*]14、"^[A-Za-z0-9]+$" //由数字和26个英文字母组成的字符串
[*]15、"^\\w+$" //由数字、26个英文字母或者下划线组成的字符串
[*]16、"^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$" //email地址
[*]17、"^[a-zA-z]+://(\\w+(-\\w+)*)(\\.(\\w+(-\\w+)*))*(\\?\\S*)?$" //url
[/list]
[*]01、"^\\d+$" //非负整数(正整数 + 0)
[*]02、"^[0-9]*[1-9][0-9]*$" //正整数
[*]03、"^((-\\d+)|(0+))$" //非正整数(负整数 + 0)
[*]04、"^-[0-9]*[1-9][0-9]*$" //负整数
[*]05、"^-?\\d+$" //整数
[*]06、"^\\d+(\\.\\d+)?$" //非负浮点数(正浮点数 + 0)
[*]07、"^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))$" //正浮点数
[*]08、"^((-\\d+(\\.\\d+)?)|(0+(\\.0+)?))$" //非正浮点数(负浮点数 + 0)
[*]09、"^(-(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*)))$" //负浮点数
[*]10、"^(-?\\d+)(\\.\\d+)?$" //浮点数
[*]11、"^[A-Za-z]+$" //由26个英文字母组成的字符串
[*]12、"^[A-Z]+$" //由26个英文字母的大写组成的字符串
[*]13、"^[a-z]+$" //由26个英文字母的小写组成的字符串
[*]14、"^[A-Za-z0-9]+$" //由数字和26个英文字母组成的字符串
[*]15、"^\\w+$" //由数字、26个英文字母或者下划线组成的字符串
[*]16、"^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$" //email地址
[*]17、"^[a-zA-z]+://(\\w+(-\\w+)*)(\\.(\\w+(-\\w+)*))*(\\?\\S*)?$" //url
[/list]
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Test {
public static void main(String[] args) {
//电子邮件
String check = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
Pattern regex = Pattern.compile(check);
Matcher matcher = regex.matcher("dffdfdf@qq.com");
boolean isMatched = matcher.matches();
System.out.println(isMatched);
}
}
如何在插入数据库后返回增加的唯一ID值 | encodeURIComponent编码后java后台的解码