/** * 检查输入的数据中是否有特殊字符 * @param qString 要检查的数据 * @param regx 特殊字符正则表达式 * @return boolean 如果包含正则表达式 <code> regx </code> 中定义的特殊字符,返回true; * 否则返回false */ public static boolean hasCrossScriptRisk(String qString) { if (qString!=null) { qString = qString.trim(); String regx= "!|!|@|◎|#|#|(\\$)|¥|%|%|(\\^)|……|(\\&)|※|(\\*)|×|(\\()|(|(\\))|)|_|——|(\\+)|+|(\\|)|§ "; Pattern p = Pattern.compile(regx,Pattern.CASE_INSENSITIVE); Matcher m = p.matcher(qString); System.out.println(m.find()); return m.find(); } return false; }