Created
August 2, 2017 09:00
-
-
Save matthung0807/58ec9623eb108bfda4b52e487350cbc9 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 str1 = new String("hello world"); | |
String str2 = new String("world hello"); | |
String str3 = new String("the world wryyyy"); | |
String regex = "^(?!.*hello)"; | |
Pattern p = Pattern.compile(regex); | |
System.out.println(p.matcher(str1).find()); // false | |
System.out.println(p.matcher(str2).find()); // false | |
System.out.println(p.matcher(str3).find()); // true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment