标签:orm org regex 工具 ons ret apach bsp mobile
package com.ict.modules.plateform.tool; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.lang3.StringUtils; /** * 正则表达式工具类 * @author hsw * */ public class RegularUtil { /** * 校验手机号 * true=isMobile("18910808534") * false=isMobile("28910808534") * false=isMobile("") * false=isMobile(null) * @param mobileNum * @return */ public static boolean isMobile(String mobileNum){ boolean b = false; if(StringUtils.isBlank(mobileNum)) return b; Pattern p = null; Matcher m = null; p = Pattern.compile("^[1][3,4,5,7,8][0-9]{9}$"); // 验证手机号 m = p.matcher(mobileNum); b = m.matches(); return b; } /** * 校验邮箱 * @param email * @return */ public static boolean isEmail(String email){ boolean b = false; if(StringUtils.isBlank(email)) return b; Pattern p = null; Matcher m = null; p = Pattern.compile("^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"); // 验证邮箱 m = p.matcher(email); b = m.matches(); return b; } }
标签:orm org regex 工具 ons ret apach bsp mobile
原文地址:http://www.cnblogs.com/go4mi/p/6426215.html