标签:java正则异常解决 patternsyntaxexcepti
/** * 转义正则特殊字符 ($()*+.[]?\^{},|) * * @param keyword * @return */ public static String escapeExprSpecialWord(String keyword) { if (StringUtils.isNotBlank(keyword)) { String[] fbsArr = { "\\", "$", "(", ")", "*", "+", ".", "[", "]", "?", "^", "{", "}", "|" }; for (String key : fbsArr) { if (keyword.contains(key)) { keyword = keyword.replace(key, "\\" + key); } } } return keyword; }
标签:java正则异常解决 patternsyntaxexcepti
原文地址:http://blog.csdn.net/bbirdsky/article/details/45368709