|
@ -25,7 +25,7 @@ public class IdCardRegexUtils { |
|
|
/** |
|
|
/** |
|
|
* 9位护照 |
|
|
* 9位护照 |
|
|
*/ |
|
|
*/ |
|
|
private static final Pattern PATTERN_9_PASSPORT = Pattern.compile("^[a-zA-Z]{2}\\d{7}$|^[a-zA-Z]{1}\\d{8}$"); |
|
|
private static final Pattern PATTERN_9_PASSPORT = Pattern.compile("^[a-zA-Z0-9]{8,9}$"); |
|
|
|
|
|
|
|
|
private String inputText; |
|
|
private String inputText; |
|
|
|
|
|
|
|
@ -86,7 +86,7 @@ public class IdCardRegexUtils { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (input.length() == 9) { |
|
|
if (input.length() == 9 || input.length() == 8) { |
|
|
Matcher matcher = PATTERN_9_PASSPORT.matcher(input); |
|
|
Matcher matcher = PATTERN_9_PASSPORT.matcher(input); |
|
|
if (matcher.matches()) { |
|
|
if (matcher.matches()) { |
|
|
return new IdCardRegexUtils(IdCardTypeEnum.PASSPORT, matcher, input); |
|
|
return new IdCardRegexUtils(IdCardTypeEnum.PASSPORT, matcher, input); |
|
|