org.apache.tools.ant.util.regexp

Interface RegexpMatcher

public interface RegexpMatcher

Interface describing a regular expression matcher.
Field Summary
intMATCH_CASE_INSENSITIVE
Perform a case insenstive match
intMATCH_DEFAULT
Default Mask (case insensitive, neither multiline nor singleline specified).
intMATCH_MULTILINE
Treat the input as a multiline input
intMATCH_SINGLELINE
Treat the input as singleline input ('.' matches newline)
Method Summary
VectorgetGroups(String argument)
Returns a Vector of matched groups found in the argument using default options.
VectorgetGroups(String input, int options)
Get the match groups from this regular expression.
StringgetPattern()
Get a String representation of the regexp pattern
booleanmatches(String argument)
Does the given argument match the pattern?
booleanmatches(String input, int options)
Does this regular expression match the input, given certain options
voidsetPattern(String pattern)
Set the regexp pattern from the String description.

Field Detail

MATCH_CASE_INSENSITIVE

public int MATCH_CASE_INSENSITIVE
Perform a case insenstive match

MATCH_DEFAULT

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

MATCH_MULTILINE

public int MATCH_MULTILINE
Treat the input as a multiline input

MATCH_SINGLELINE

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

Method Detail

getGroups

public Vector getGroups(String argument)
Returns a Vector of matched groups found in the argument using default options.

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

.

Parameters: argument the string to match against

Returns: the vector of groups

Throws: BuildException on error

getGroups

public Vector getGroups(String input, int options)
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.

Returns: the vector of groups

Throws: BuildException on error

getPattern

public String getPattern()
Get a String representation of the regexp pattern

Returns: the pattern

Throws: BuildException on error

matches

public boolean matches(String argument)
Does the given argument match the pattern?

Parameters: argument the string to match against

Returns: true if the pattern matches

Throws: BuildException on error

matches

public boolean matches(String input, int options)
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.

Returns: true if the pattern matches

Throws: BuildException on error

setPattern

public void setPattern(String pattern)
Set the regexp pattern from the String description.

Parameters: pattern the pattern to match

Throws: BuildException on error

Copyright B) 2000-2007 Apache Software Foundation. All Rights Reserved.