Created
August 2, 2017 08:43
-
-
Save matthung0807/be7260b0fdd6a7a19ac6f284b1b9f619 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String regex1 = "^hello"; | |
String str = new String("hello"); | |
Pattern p1 = Pattern.compile(regex1); | |
System.out.println(p1.matcher(str).matches()); // true | |
String regex2 = "[^hello]"; | |
Pattern p2 = Pattern.compile(regex2); | |
System.out.println(p2.matcher(str).matches()); // false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment