|
|
|
@ -1,7 +1,6 @@
|
|
|
|
|
package com.fr.design.actions.replace.utils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.design.actions.replace.ui.ITReplaceMainDialog; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import com.fr.stable.collections.combination.Pair; |
|
|
|
@ -30,6 +29,7 @@ public class ShowValueUtils {
|
|
|
|
|
public static final String NUMBER_REGEX = "[0-9]"; |
|
|
|
|
public static final String ENGLISH_REGEX = "[a-zA-Z]"; |
|
|
|
|
private static List<String> specialCharList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
static { |
|
|
|
|
//正则特殊字符:? * () [] {} ^ $ .
|
|
|
|
|
//如果是? 并采用通配符 ,会自动转成“.” 所以 ? 不用处理
|
|
|
|
@ -84,8 +84,8 @@ public class ShowValueUtils {
|
|
|
|
|
*/ |
|
|
|
|
public static String changeRegex(String regex) { |
|
|
|
|
String change = "\\"; |
|
|
|
|
for (int i = 0 ; i < specialCharList.size() ; i ++){ |
|
|
|
|
regex = regex.replace(specialCharList.get(i),change + specialCharList.get(i)); |
|
|
|
|
for (int i = 0; i < specialCharList.size(); i++) { |
|
|
|
|
regex = regex.replace(specialCharList.get(i), change + specialCharList.get(i)); |
|
|
|
|
} |
|
|
|
|
regex = regex.replace(NUMBER, NUMBER_REGEX); |
|
|
|
|
regex = regex.replace(ENGLISH, ENGLISH_REGEX); |
|
|
|
@ -185,6 +185,12 @@ public class ShowValueUtils {
|
|
|
|
|
return failReturn; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 支持通配符的contains |
|
|
|
|
* @param originStr |
|
|
|
|
* @param matchStr |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public static boolean contains(String originStr, String matchStr) { |
|
|
|
|
if (ITReplaceMainDialog.isMatched()) { |
|
|
|
|
String str = changeRegex(matchStr); |
|
|
|
|