RegexpMatcher (Apache Ant API)

org.apache.tools.ant.util.regexp
Interface RegexpMatcher

All Known Subinterfaces:
Regexp
All Known Implementing Classes:
JakartaOroMatcher, JakartaOroRegexp, JakartaRegexpMatcher, JakartaRegexpRegexp, Jdk14RegexpMatcher, Jdk14RegexpRegexp

public interface RegexpMatcher

Interface describing a regular expression matcher.

Author:
Stefan Bodewig
, Matthew Inger

Field Summary
static int MATCH_CASE_INSENSITIVE
          Perform a case insenstive match
static int MATCH_DEFAULT
          Default Mask (case insensitive, neither multiline nor singleline specified).
static int MATCH_MULTILINE
          Treat the input as a multiline input
static int MATCH_SINGLELINE
          Treat the input as singleline input ('.' matches newline)
 
Method Summary
 java.util.Vector getGroups(java.lang.String argument)
          Returns a Vector of matched groups found in the argument.
 java.util.Vector getGroups(java.lang.String input, int options)
          Get the match groups from this regular expression.
 java.lang.String getPattern()
          Get a String representation of the regexp pattern
 boolean matches(java.lang.String argument)
          Does the given argument match the pattern?
 boolean matches(java.lang.String input, int options)
          Does this regular expression match the input, given certain options
 void setPattern(java.lang.String pattern)
          Set the regexp pattern from the String description.
 

Field Detail

MATCH_DEFAULT


public static final int MATCH_DEFAULT
Default Mask (case insensitive, neither multiline nor singleline specified).

See Also:
Constant Field Values

MATCH_CASE_INSENSITIVE


public static final int MATCH_CASE_INSENSITIVE
Perform a case insenstive match

See Also:
Constant Field Values

MATCH_MULTILINE


public static final int MATCH_MULTILINE
Treat the input as a multiline input

See Also:
Constant Field Values

MATCH_SINGLELINE


public static final int MATCH_SINGLELINE
Treat the input as singleline input ('.' matches newline)

See Also:
Constant Field Values
Method Detail

setPattern


public void setPattern(java.lang.String pattern)
                throws BuildException
Set the regexp pattern from the String description.

BuildException

getPattern


public java.lang.String getPattern()
                            throws BuildException
Get a String representation of the regexp pattern

BuildException

matches


public boolean matches(java.lang.String argument)
                throws BuildException
Does the given argument match the pattern?

BuildException

getGroups


public java.util.Vector getGroups(java.lang.String argument)
                           throws BuildException
Returns a Vector of matched groups found in the argument.

Group 0 will be the full match, the rest are the parenthesized subexpressions

.

BuildException

matches


public boolean matches(java.lang.String input,
                       int options)
                throws BuildException
Does this regular expression match the input, given certain options

Parameters:
input - The string to check for a match
options - The list of options for the match. See the MATCH_ constants above.
BuildException

getGroups


public java.util.Vector getGroups(java.lang.String input,
                                  int options)
                           throws BuildException
Get the match groups from this regular expression. The return type of the elements is always String.

Parameters:
input - The string to check for a match
options - The list of options for the match. See the MATCH_ constants above.
BuildException


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.