import java.util.regex.Matcher;
import java.util.regex.Pattern;
...
Pattern p = Pattern.compile( ".gloss\\.html" );
Pattern p = Pattern.compile( "g.*\\.txt" );
Pattern p = Pattern.compile( "(cat|dog)\\.html" );
Pattern p = Pattern.compile( "(?!cat\\.html$|dog\\.html$).*\\.html" );
Pattern p = Pattern.compile( "[a-z0-9\\-_\\.]++@[a-z0-9\\-]++(\\.[a-z0-9\\-]++)++" );
Pattern p = Pattern.compile( "r.*\\\\.*\\..*" );
Pattern titleFinder = Pattern.compile( ".*\\<title>([a-zA-Z0-9 ]*)\\</title>.*" );
Matcher m = titleFinder.matcher( "some stuff <title>Exploring Kenya</title> more stuff" );
out.println( "matches? " + m.matches() );
out.println( "count: " + m.groupCount() );
out.println( "whole: " + m.group( 0 ));
out.println( "captured title: " + m.group( 1 ));
private static final Pattern startGenerated = Pattern.compile( "\\<\\!\\-\\-\\s*generated\\s*\\-\\-\\>" );
...
if ( startGenerated.matcher( candidate ).matches() )
{
out.println( "fits the pattern" );
}