org.apache.anteater.util.regexp
Interface RegexpUtil

All Known Implementing Classes:
ORORegexpUtil

public interface RegexpUtil

Interface for regexp utility bean implementations. An instance of this should be obtained through a RegexpUtilFactory.

Version:
$Revision: 1.1 $ $Date: 2002/08/11 13:00:55 $
Author:
Jeff Turner
See Also:
RegexpUtilFactory

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.
 

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.

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.

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.

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