无效的转义序列(有效的是 \b \t \n \f \r \" \' \ )
public static final boolean isValidPhoneNumber(CharSequence target) {
if (target == null || TextUtils.isEmpty(target)) {
Pattern numberPattern = Pattern.compile("^((\+){0,1}91(\s){0,1}(\-){0,1}(\s){0,1})?([0-9]{10})$");
Matcher numberMatcher = numberPattern.matcher(target);
return numberMatcher.matches();
}
return false;
}
我使用在线检查的正则表达式工作正常,但不适用于我的 android 应用程序。请帮忙...