FileDocCategorySizeDatePackage
FindAll.javaAPI DocExample626Wed Apr 20 15:11:22 BST 2005None

FindAll

public class FindAll extends Object

Fields Summary
Constructors Summary
Methods Summary
public static java.util.ListfindAll(java.util.regex.Pattern pattern, java.lang.CharSequence text)

	List<MatchResult> results = new ArrayList<MatchResult>();
	Matcher m = pattern.matcher(text);
	while(m.find()) results.add(m.toMatchResult());
	return results;
    
public static voidmain(java.lang.String[] args)

	Pattern pattern = Pattern.compile(args[0]);
	String text = args[1];

	List<MatchResult> results = findAll(pattern, text);
	for(MatchResult r : results) {
	    System.out.printf("Found '%s' at (%d,%d)%n",
			      r.group(), r.start(), r.end());
	}