File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
src/main/java/emailvalidator4j/lexer Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ public class EmailLexer {
1616
1717 public void lex (String input ) {
1818 Pattern pattern = Pattern .compile (
19- "([a-zA-Z_]+[46]?)|([0-9]+)|(\r \n )|(::)|(\\ s+?)|(.)" , Pattern .CASE_INSENSITIVE | Pattern .UNICODE_CASE
19+ "([a-zA-Z_]+[46]?)|([0-9]+)|(\r \n )|(::)|(\\ s+?)|(.)|( \\ p{Cc}+) " , Pattern .CASE_INSENSITIVE | Pattern .UNICODE_CASE
2020 );
2121 Matcher matcher = pattern .matcher (input );
2222
Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ public enum Tokens implements TokenInterface {
3535 public static final String INVALID = "INVALID" ;
3636
3737 private static final HashMap <String , TokenInterface > tokensMap = new HashMap <String , TokenInterface >();
38+ private static final Pattern invalidUTF8 = Pattern .compile ("\\ p{Cc}+" ,
39+ Pattern .UNICODE_CASE | Pattern .CASE_INSENSITIVE );
40+
3841 private final String name ;
3942 private final String text ;
4043
@@ -64,10 +67,7 @@ public static TokenInterface get(String value) {
6467 }
6568
6669 private static boolean isUTF8Invalid (String match ) {
67- Pattern pattern = Pattern .compile ("\\ p{Cc}+" , Pattern .UNICODE_CASE | Pattern .CASE_INSENSITIVE );
68- Matcher matcher = pattern .matcher (match );
69-
70- return matcher .find ();
70+ return invalidUTF8 .matcher (match ).find ();
7171 }
7272
7373 public boolean equals (TokenInterface that ) {
You can’t perform that action at this time.
0 commit comments