(Java) Regular Expression Test

xiaoxiao2021-03-06  111

During the previous period, during the graduation design, because I wanted to make the program, I learned the regular expression, and then I had the following code, and test it. / ** Retry.class * Author: Jack * Date: 2004-10 * / Import java.util.regex. *; Import java.io. *;

public class RETry {public static void main (String [] args) {Pattern p; Matcher m; BufferedReader in = new BufferedReader (new InputStreamReader (System.in)); boolean done = false; String line = new String ();

System.out.println ("Copyright @ 2004, Author Jack Lee, Version 1.0); System.out.Println (" Welcom to Use! ");

System.out.Print ("Now Give Me A Pattern:"); try {line = in.readline ();} catch (ooException e) {} if ("quit") {system.out. Println ("BYE!"); System.exit (0);

P = pattern.Compile (line);

While (! done) {system.out.print ("Command >>");

转载请注明原文地址:https://www.9cbs.com/read-99705.html

New Post(0)