import java.util.*;
import java.util.regex.*;
public class Reg {
    static boolean first = true;
    public static void test(String pattern) {
        String input = "The phonephone number is (201)555-1212.";
        Scanner s = new Scanner(input);
        if(first) { System.out.println(input); first=false; }
        System.out.print("'"+pattern+"' -> ");
        while(s.hasNextLine()) {
            if(s.findInLine(pattern) != null) {
                MatchResult m = s.match();
                System.out.println("'"+m.group(0)+"'");
            } else {
                System.out.println("Nothing");
            }
            break;
        }
    }
    public static void main(String[] args) {
        test("phone");
        test("phone+");
        test("(phone)+");
        test("(phone)*");
        test("(The)*");
        test("\\d+");
        test("[0-9-]+");
        test("[0-9()-]+");
        test("fish");
        test("\\w+\\s+");
        test("(\\w+\\s+)*");
    }
}