Created
July 31, 2017 07:16
-
-
Save matthung0807/553c11c7b5eb9f59e288754cf265dff6 to your computer and use it in GitHub Desktop.
This file contains 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
Pattern p = Pattern.compile("^he"); // Pattern.compile()的參數字串為正規表示式 | |
Matcher m = p.matcher("hello world"); // matcher()的參數為要查詢的字串 | |
System.out.println(m.find()); // 若查詢的字串的子字串符合正規表示式的規則,Matcher.find()回傳true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment