org.apache.anteater.util.regexp
Class ORORegexpUtil

java.lang.Object
  |
  +--org.apache.anteater.util.regexp.ORORegexpUtil
All Implemented Interfaces:
RegexpUtil

public class ORORegexpUtil
extends Object
implements RegexpUtil

A stateful regexp utility bean, implemented with the ORO library.

Version:
$Revision: 1.2 $ $Date: 2002/10/23 16:59:43 $
Author:
Jeff Turner

Constructor Summary
ORORegexpUtil()
           
 
Method Summary
 boolean applyRegexp(String patternStr, String valueStr, boolean ignoreCase, boolean singleLine)
          Applies a regexp pattern to a string, and returns whether the string contained the matched pattern.
 boolean applyRegexp(String patternStr, String valueStr, boolean ignoreCase, boolean singleLine, boolean contains)
          Applies a regexp pattern to a string, and returns whether the string, or a part of the string, matched the pattern.
 String getGroupValue(int group)
          Retrieve part of the string that a regexp was applied to in applyRegexp(java.lang.String, java.lang.String, boolean, boolean), as specified by a regexp 'group', ie (..) notation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ORORegexpUtil

public ORORegexpUtil()
Method Detail

applyRegexp

public boolean applyRegexp(String patternStr,
                           String valueStr,
                           boolean ignoreCase,
                           boolean singleLine)
Applies a regexp pattern to a string, and returns whether the string contained the matched pattern.

Specified by:
applyRegexp in interface RegexpUtil
Parameters:
patternStr - regexp pattern
valueStr - String to try to match
ignoreCase - whether pattern ignores case
singleLine - whether '.' matches newline characters in valueStr
Returns:
whether a part of valueStr matched the regexp pattern.

applyRegexp

public boolean applyRegexp(String patternStr,
                           String valueStr,
                           boolean ignoreCase,
                           boolean singleLine,
                           boolean contains)
                    throws org.apache.tools.ant.BuildException
Applies a regexp pattern to a string, and returns whether the string, or a part of the string, matched the pattern.

Specified by:
applyRegexp in interface RegexpUtil
Parameters:
patternStr - regexp pattern
valueStr - String to try to match
ignoreCase - whether pattern ignores case
singleLine - whether '.' matches newline characters in valueStr
contains - Whether to test if the regexp matches a substring, or the whole string.
Returns:
whether the whole, or part of valueStr matched the regexp pattern.
org.apache.tools.ant.BuildException

getGroupValue

public String getGroupValue(int group)
Retrieve part of the string that a regexp was applied to in applyRegexp(java.lang.String, java.lang.String, boolean, boolean), as specified by a regexp 'group', ie (..) notation.

Specified by:
getGroupValue in interface RegexpUtil
Parameters:
group - group id to retrieve
Returns:
A String containing a subset of that matched with applyRegexp(java.lang.String, java.lang.String, boolean, boolean), corresponding to the indicated group, or null if no groups were specified in the RE.
Throws:
RuntimeException - If this is called before applyRegexp(java.lang.String, java.lang.String, boolean, boolean).


Ant Functional Tester -- see Project home page for details