| Regular Expression Test Applet Fall 2002, David Matuszek |
The point of this applet is to provide a convenient means of testing regular
expressions before embedding them in a Java program. The buttons represent calls
to the Java methods with the same name.
The applet executes (approximately) the following code:
pattern = Pattern.compile(Contents of the Pattern: field); matcher = pattern.matcher(Contents of the String: field); matcher.Whatever_method_you_clicked(); Display results;
The In Java: field shows how you would have to write the regular
expression as a Java literal string. You cannot type into this area, but you
can copy from it and paste the literal string into your Java programs.
For successful matches, the Results: area will show what values
you will get if you call the methods start(), end(),
and group(n).
For those who are interested, here's the source code. Please inform me of any bugs you find.