/**   
 * @Title: RegexUtil.java 
 * @Package me.pc.mobile.helper.util 
 * @Description: TODO
 * @author SilentKnight || happychinapc[at]gmail[dot]com   
 * @date 2014 2014年12月4日 下午4:45:45 
 * @version V1.0.0   
 */
package me.pc.mobile.helper.v14.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @ClassName: RegexUtil
 * @Description: TODO
 * @author SilentKnight || happychinapc@gmail.com
 * @date 2014年12月4日 下午4:45:45
 * 
 */
public final class RegexUtil {
	
	private RegexUtil() {
	}

	public static final String EMAIL_REGEX = "^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$";
	public static final String MOBILE_NUM_REGEX = "^(\\+86)?((13[0-9])|(15[^4,\\D])|(18[^4,\\D])|(170))\\d{8}$";
	public static final String QQ_REGEX = "^[1-9][0-9]{4,9}$";

	/**
	 * @Title: isEmailValid
	 * @Description: verify a valid email address
	 * @param email
	 * @return boolean
	 * @throws null
	 */
	public static boolean isEmailValid(String email) {
		boolean flag = false;
		flag = email.matches(EMAIL_REGEX);
		return flag;
	}

	/**
	 * @Title: isMobileNumValid
	 * @Description: verify a valid mobile number
	 * @param mobileNum
	 * @return boolean
	 * @throws null
	 */
	public static boolean isMobileNumValid(String mobileNum) {
		boolean flag = false;
		flag = mobileNum.matches(MOBILE_NUM_REGEX);
		return flag;
	}

	/**
	 * @Title: isQQNumValid
	 * @Description: TODO
	 * @param qq
	 * @return boolean
	 * @throws
	 */
	public static boolean isQQNumValid(String qq) {
		boolean flag = false;
		flag = qq.matches(QQ_REGEX);
		return flag;
	}

	/**
	 * @Title: compile
	 * @Description: TODO
	 * @param @param source
	 * @param @param regex
	 * @param @param newValue
	 * @param @return
	 * @return String
	 */
	public static String compile(String source, String regex, String newValue) {
		Pattern patterns = Pattern.compile(regex);
		Matcher matcher = patterns.matcher(source);
		if (matcher.find()) {
			for (int i = 0; i < matcher.groupCount(); i++) {
				String group = matcher.group(i);
				source.replace(group, newValue);
			}
		}
		return source;
	}
}

@@ -808,16 +808,325 @@
 4,9%7D$%22;%0A
+%09public static final String PASSWORD_REGEX = %22%5E%5B1-9a-zA-X%5D%7B6,20%7D$%22;%0A%0A%09/**%0A%09 * @Title: isPasswordValid%0A%09 * @Description: verify a valid password.%0A%09 * @param email%0A%09 * @return boolean%0A%09 * @throws null%0A%09 */%0A%09public static boolean isPasswordValid(String password) %7B%0A%09%09return password.matches(PASSWORD_REGEX);%0A%09%7D%0A%09
 %0A%09/**%0A%09 

Update RegexUtil.java