@@ -0,0 +1,1469 @@
+package yunfeiImplementAlgs4;%0A%0A/**%0A * Created by guoy28 on 4/14/17.%0A */%0A%0Aimport edu.princeton.cs.algs4.StdOut;%0A%0A/******************************************************************************%0A *  Compilation:  javac Validate.java%0A *  Execution:    java Validate pattern text%0A *  Dependencies: StdOut.java%0A *%0A *  Reads in a regular expression and a text input string from the%0A *  command line and prints true or false depending on whether%0A *  the pattern matches the text.%0A *%0A *  %25 java Validate %22..oo..oo.%22 bloodroot%0A *  true%0A *%0A *  %25 java Validate %22..oo..oo.%22 nincompoophood%0A *  false%0A *%0A *  %25 java Validate %22%5B%5Eaeiou%5D%7B6%7D%22 rhythm%0A *  true%0A *%0A *  %25 java Validate %22%5B%5Eaeiou%5D%7B6%7D%22 rhythms%0A *  false%0A *%0A ******************************************************************************/%0A%0Apublic class Validate %7B%0A%0A  public static void main(String%5B%5D args) %7B%0A    //String regexp = args%5B0%5D;%0A    //String text   = args%5B1%5D;%0A    String regexp = %22(a%7Caa)*b%22;%0A    for (String text : new String%5B%5D%7B%22aaaaaaaaaaaaaaaaaaaaaaaaaaaaaac%22,%0A            %22aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac %22,%0A            %22aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac%22,%0A            %22aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac%22,%0A            %22aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac%22%7D) %7B%0A%0A      StdOut.print(regexp + %22 matching %22 + text + %22 %22);%0A      long start = System.nanoTime();%0A      StdOut.print(text.matches(regexp));%0A      long end = System.nanoTime();%0A      StdOut.println(%22 %22 + (end-start)/1e9 + %22 seconds.%22);%0A    %7D%0A  %7D%0A%0A%7D%0A

add regex matching client