Package org.apache.tools.ant.util.regexp
Interface RegexpMatcher
-
- All Known Subinterfaces:
Regexp
- All Known Implementing Classes:
JakartaOroMatcher,JakartaOroRegexp,JakartaRegexpMatcher,JakartaRegexpRegexp,Jdk14RegexpMatcher,Jdk14RegexpRegexp
public interface RegexpMatcherInterface describing a regular expression matcher.
-
-
Field Summary
Fields Modifier and Type Field Description static intMATCH_CASE_INSENSITIVEPerform a case insensitive matchstatic intMATCH_DEFAULTDefault Mask (case insensitive, neither multiline nor singleline specified).static intMATCH_MULTILINETreat the input as a multiline inputstatic intMATCH_SINGLELINETreat the input as singleline input ('.' matches newline)
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Vector<java.lang.String>getGroups(java.lang.String argument)Returns a Vector of matched groups found in the argument using default options.java.util.Vector<java.lang.String>getGroups(java.lang.String input, int options)Get the match groups from this regular expression.java.lang.StringgetPattern()Get a String representation of the regexp patternbooleanmatches(java.lang.String argument)Does the given argument match the pattern?booleanmatches(java.lang.String input, int options)Does this regular expression match the input, given certain optionsvoidsetPattern(java.lang.String pattern)Set the regexp pattern from the String description.
-
-
-
Field Detail
-
MATCH_DEFAULT
static final int MATCH_DEFAULT
Default Mask (case insensitive, neither multiline nor singleline specified).- See Also:
- Constant Field Values
-
MATCH_CASE_INSENSITIVE
static final int MATCH_CASE_INSENSITIVE
Perform a case insensitive match- See Also:
- Constant Field Values
-
MATCH_MULTILINE
static final int MATCH_MULTILINE
Treat the input as a multiline input- See Also:
- Constant Field Values
-
MATCH_SINGLELINE
static final int MATCH_SINGLELINE
Treat the input as singleline input ('.' matches newline)- See Also:
- Constant Field Values
-
-
Method Detail
-
setPattern
void setPattern(java.lang.String pattern) throws BuildExceptionSet the regexp pattern from the String description.- Parameters:
pattern- the pattern to match- Throws:
BuildException- on error
-
getPattern
java.lang.String getPattern() throws BuildExceptionGet a String representation of the regexp pattern- Returns:
- the pattern
- Throws:
BuildException- on error
-
matches
boolean matches(java.lang.String argument) throws BuildExceptionDoes the given argument match the pattern?- Parameters:
argument- the string to match against- Returns:
- true if the pattern matches
- Throws:
BuildException- on error
-
getGroups
java.util.Vector<java.lang.String> getGroups(java.lang.String argument) throws BuildExceptionReturns 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
-
matches
boolean matches(java.lang.String input, int options) throws BuildExceptionDoes this regular expression match the input, given certain options- Parameters:
input- The string to check for a matchoptions- The list of options for the match. See the MATCH_ constants above.- Returns:
- true if the pattern matches
- Throws:
BuildException- on error
-
getGroups
java.util.Vector<java.lang.String> getGroups(java.lang.String input, int options) throws BuildExceptionGet the match groups from this regular expression. The return type of the elements is always String.- Parameters:
input- The string to check for a matchoptions- The list of options for the match. See the MATCH_ constants above.- Returns:
- the vector of groups
- Throws:
BuildException- on error
-
-