Matcher Find : Matcher « Development « Java Tutorial






import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class MainClass {

  public static void main(String[] args) {
    Matcher m = Pattern.compile("\\w+").matcher("Today is Sunday");
    while (m.find())
      System.out.println(m.group());
    int i = 0;
    while (m.find(i)) {
      System.out.print(m.group() + " ");
      i++;
    }
  }
}
/* */
Today
is
Sunday
Today oday day ay y is is s Sunday Sunday unday nday day ay y








6.33.Matcher
6.33.1.Matcher Start and End
6.33.2.Matcher.LookingAt
6.33.3.Matcher Find