Published on ONJava.com (http://www.onjava.com/)  See this if
you're having trouble printing code examples  Regular
Expressions in J2SE  by Hetal C. Shah  In Java applications that
do text searching and manipulation, the StringTokenizer and
String classes are used heavily. This can often result in
complex code and lead to a maintenance nightmare.  Often such
Java applications are looking for an occurrence of a particular
character or token in a String, and then trying to find a string
surrounding it, validating the extracted String. A simple
example is validation of a web site URL or an email address. To
validate an email address, we could check for an occurrence of
'@', followed by one or more '.'. This logic might be
implemented in Java as shown below.  JDK 1.4 supports regular
expressions in the java.util.regex package. Use of this package
and supporting classes makes string search and manipulation very
easy. It helps reduce the development effort, and at the same
time significantly improves the maintenanc