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