/** * @title * @description 替换正则表达式中的所有特殊字符 * @author HUAZAI * @param * <ul> * <li></li> * <li></li> * <ul> * @return * <ul> * <li></li> * <li></li> * <ul> * @throws * @date 2018-03-13 16:58:30 */ public static String replaceQueryStringAllRegExp(String str) { String strTemp = null; String[] from = {"\\", "*", "+", "|", "{", "}", "(", ")", "^", "$", "[", "]", "?", ",", ".", "&"}; String[] to = {"\\\\", "\\*", "\\+", "\\|", "\\{", "\\}", "\\(", "\\)", "\\^", "\\$", "\\[", "\\]", "\\?", "\\,", "\\.", "\\&"}; return StringUtils.replaceEach(str, from, to); }
将正则表达式中的特殊字符转义
最新推荐文章于 2024-09-05 15:34:38 发布