Package org.languagetool.rules.patterns
Class StringMatcher
java.lang.Object
org.languagetool.rules.patterns.StringMatcher
An object encapsulating a text pattern and the way it's matched (case-sensitivity / regular expression),
plus some optimizations over standard regular expression matching.
- Since:
- 5.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final boolean(package private) final booleanstatic final int(package private) final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateStringMatcher(String pattern, boolean isRegExp, boolean caseSensitive) -
Method Summary
Modifier and TypeMethodDescriptionstatic StringMatchergetPossibleRegexpValues(String regexp) (package private) static SubstringsgetRequiredSubstrings(String regexp) abstract booleanstatic StringMatcherCreate a case-sensitive regexp matcher.private static StringMatcherstringEquals(String pattern, boolean isRegExp, boolean caseSensitive)
-
Field Details
-
pattern
-
caseSensitive
final boolean caseSensitive -
isRegExp
final boolean isRegExp -
MAX_MATCH_LENGTH
public static final int MAX_MATCH_LENGTH- See Also:
-
-
Constructor Details
-
StringMatcher
-
-
Method Details
-
getPossibleValues
- Returns:
- all values that this matcher can possibly accept (e.g. extracted from regexps like "foo|bar"),
or
nullif it's not possible to determine those.
-
matches
- Returns:
- whether the given string is accepted by this matcher.
-
regexp
Create a case-sensitive regexp matcher.- Since:
- 5.6
-
create
-
stringEquals
@NotNull private static StringMatcher stringEquals(String pattern, boolean isRegExp, boolean caseSensitive) -
getRequiredSubstrings
- Returns:
- the substrings that any text would necessarily contain or start/end with if it matches the given regexp,
or
nullif no such substrings can be found
-
getPossibleRegexpValues
- Returns:
- all strings that the given regexp can ever match, or
nullif such set couldn't be enumerated
-