public class VariableStringMatcher extends StringMatcher
StringMatcher
tests whether strings start with a specified variable string and then
match another optional given StringMatcher
.Constructor and Description |
---|
VariableStringMatcher(char[] allowedCharacters,
char[] disallowedCharacters,
int minimumLength,
int maximumLength,
StringMatcher nextMatcher)
Creates a new VariableStringMatcher.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getMatchingString()
Returns the string that has been matched most recently.
|
protected boolean |
matches(java.lang.String string,
int beginOffset,
int endOffset)
Checks whether the given substring matches.
|
matches, prefix
public VariableStringMatcher(char[] allowedCharacters, char[] disallowedCharacters, int minimumLength, int maximumLength, StringMatcher nextMatcher)
allowedCharacters
- an optional list of allowed characters.disallowedCharacters
- an optional list of disallowed characters.minimumLength
- the minimum length of te variable string.maximumLength
- the maximum length of te variable string.nextMatcher
- an optional next matcher for the remainder of the string.public java.lang.String getMatchingString()
protected boolean matches(java.lang.String string, int beginOffset, int endOffset)
StringMatcher
matches
in class StringMatcher
string
- the string to match.beginOffset
- the start offset of the substring (inclusive).endOffset
- the end offset of the substring (exclusive).