mirror of
https://github.com/pppscn/SmsForwarder
synced 2025-08-03 01:17:41 +08:00
改进正则表达式匹配方式
This commit is contained in:
parent
c9409082ea
commit
e00a2b8f42
@ -8,6 +8,7 @@ import com.idormy.sms.forwarder.utils.RuleLineUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
@ -172,7 +173,13 @@ public class RuleModel {
|
||||
case CHECK_REGEX:
|
||||
if (msgValue != null) {
|
||||
try {
|
||||
checked = Pattern.matches(this.value, msgValue);
|
||||
//checked = Pattern.matches(this.value, msgValue);
|
||||
Pattern pattern = Pattern.compile(this.value, Pattern.CASE_INSENSITIVE);
|
||||
Matcher matcher = pattern.matcher(msgValue);
|
||||
while (matcher.find()) {
|
||||
checked = true;
|
||||
break;
|
||||
}
|
||||
} catch (PatternSyntaxException e) {
|
||||
checked = false;
|
||||
Log.d(TAG, "PatternSyntaxException: ");
|
||||
|
Loading…
x
Reference in New Issue
Block a user