So in php I can make a regex and pass it to preg_match_all and it gives me a 2D array of all the matches. can you accomplish this in java? The specs of preg_match_all are here:
PHP: preg_match_all - Manual
1 reply to this topic
#1
Posted 13 April 2011 - 08:36 AM
|
|
|
#2
Posted 13 April 2011 - 12:40 PM
Pattern pattern = Pattern.compile("regex here");
Matcher matcher = pattern.matcher("input string here");
while (matcher.find()) {
System.out.println(matcher.group());
}
If you want an array, you'll have to get it in an array instead of printing it now, in this code sample.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









