FileDocCategorySizeDatePackage
NLMatch.javaAPI DocExample906Sun Feb 08 21:33:42 GMT 2004None

NLMatch

public class NLMatch extends Object
Show line ending matching using RE class.
author
Ian F. Darwin, http://www.darwinsys.com/
version
$Id: NLMatch.java,v 1.6 2004/02/09 03:33:42 ian Exp $

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] argv)


		String input = "I dream of engines\nmore engines, all day long";
		System.out.println("INPUT: " + input);
		System.out.println();

		String[] patt = {
			"engines.more engines",
			"engines$"
		};

		for (int i = 0; i < patt.length; i++) {
			System.out.println("PATTERN " + patt[i]);

			boolean found;
			Pattern p1l = Pattern.compile(patt[i]);
			found = p1l.matcher(input).find();
			System.out.println("DEFAULT match " + found);

			Pattern pml = Pattern.compile(patt[i], 
				Pattern.DOTALL|Pattern.MULTILINE);
			found = pml.matcher(input).find();
			System.out.println("MultiLine match " + found);
			System.out.println();
		}