Created
October 2, 2015 01:56
-
-
Save masudak/4d79dba525ce18149540 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
public static void main(String[] args) { | |
String str = "2009time"; | |
String regex = "(\\d+)(t)"; | |
Pattern p = Pattern.compile(regex); | |
Matcher m = p.matcher(str); | |
if (m.find()) { | |
String matchstr = m.group(); | |
System.out.println(matchstr + "の部分にマッチしました"); | |
System.out.println("group1: " + m.group(1)); | |
System.out.println("group2: " + m.group(2)); | |
} | |
} |
Author
masudak
commented
Oct 2, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment