| 25 | } |
| 26 | } |
| 27 | static void examine(String s, String regex) { |
| 28 | Display d = new Display(regex); |
| 29 | Pattern p = Pattern.compile(regex); |
| 30 | Matcher m = p.matcher(s); |
| 31 | while(m.find()) |
| 32 | d.display("find() '" + m.group() + |
| 33 | "' start = "+ m.start() + " end = " + m.end()); |
| 34 | if(m.lookingAt()) // No reset() necessary |
| 35 | d.display("lookingAt() start = " |
| 36 | + m.start() + " end = " + m.end()); |
| 37 | if(m.matches()) // No reset() necessary |
| 38 | d.display("matches() start = " |
| 39 | + m.start() + " end = " + m.end()); |
| 40 | } |
| 41 | public static void main(String[] args) { |
| 42 | for(String in : input.split("\n")) { |
| 43 | System.out.println("input : " + in); |