FileDocCategorySizeDatePackage
REmatch.javaAPI DocExample568Fri Feb 27 20:21:26 GMT 2004None

REmatch

public class REmatch extends Object
REmatch -- demonstrate RE Match -> group()
author
Ian F. Darwin, http://www.darwinsys.com/
version
$Id: REmatch.java,v 1.5 2004/02/28 02:21:26 ian Exp $

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


		String patt = "Q[^u]\\d+\\.";
		Pattern r = Pattern.compile(patt);
		String line = "Order QT300. Now!";
		Matcher m = r.matcher(line);
		if (m.find()) {
			System.out.println(patt + " matches \"" +
				m.group(0) +
				"\" in \"" + line + "\"");
		} else {
			System.out.println("NO MATCH");
		}