org.apache.tapestry.util
Class RegexpMatcher

java.lang.Object
  extended by org.apache.tapestry.util.RegexpMatcher

public class RegexpMatcher
extends Object

Streamlines the interface to ORO by implicitly constructing the necessary compilers and matchers, and by caching compiled patterns.


Constructor Summary
RegexpMatcher()
           
 
Method Summary
 void clear()
          Clears any previously compiled patterns.
 boolean contains(String pattern, String input)
           
 String getEscapedPatternString(String pattern)
           
 RegexpMatch[] getMatches(String pattern, String input)
          Given an input string, finds all matches in an input string for the pattern.
 String[] getMatches(String pattern, String input, int subgroup)
          Given an input string, finds all matches in an input string for the pattern.
 boolean matches(String pattern, String input)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegexpMatcher

public RegexpMatcher()
Method Detail

clear

public void clear()
Clears any previously compiled patterns.


matches

public boolean matches(String pattern,
                       String input)

contains

public boolean contains(String pattern,
                        String input)

getEscapedPatternString

public String getEscapedPatternString(String pattern)

getMatches

public RegexpMatch[] getMatches(String pattern,
                                String input)
Given an input string, finds all matches in an input string for the pattern.

Parameters:
pattern - the regexp pattern for matching
input - the string to search for matches within
Returns:
array (possibly empty) of matches
Since:
4.0

getMatches

public String[] getMatches(String pattern,
                           String input,
                           int subgroup)
Given an input string, finds all matches in an input string for the pattern.

Parameters:
pattern - the regexp pattern for matching
input - the string to search for matches within
subgroup - the group (sub-expression) within the pattern to return as a match
Returns:
array (possibly empty) of matching strings


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.