常用正则表达式
1.判断一个字符串中是否包含日期 yyyy-MM-dd
Pattern pattern = Pattern.compile("\\d{4}\\-(0?[1-9]|[1][012])\\-(0?[1-9]|[12][0-9]|3[01])");
Matcher matcher = pattern.matcher(date);
2.是否包含手机号
Pattern mobilePattern = Pattern.compile("^((13[0-9])|(14[5|7])|(15[^4,\\D])|(18[0-9])|(17[0-9])|(166)|(19[8|9]))\\d{8}$");
Matcher mobileMatcher = mobilePattern.matcher(mobile.trim());
3.是否包含邮箱
Pattern emailPattern = Pattern.compile("^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$");
Matcher emailMatcher = emailPattern.matcher(email.trim());
请关于一下啦^_^
微信公众号