Interface RE
public interface RE
A library to make regular expressions with
Pattern a bit easier to
use. The Pattern class is extremely powerfull and as far as I know high
performance. However,regular expressions quickly become unwieldy.
This class provides a more modern interface using lambdas and options and the
accompanying Catalog class provides a comprehensive set of constants
and static methods to create complex regular expressions.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents a Character Class in a regular expression.static interfaceRepresents a flag.static interfaceA group is a regular expression that groups a set of REs.static interfaceThe result of a matched group after a successful find, matches, or lookingAt operation.static interfaceProvides the details of a matching group.static interfaceThe `*`, `?`, `+` operators and the `{...}` suffix quantify the previous node. -
Method Summary
Modifier and TypeMethodDescriptionvoidAppend the StringBuilder by finding all this matches in the given string, and using the replacement from the replacement function.default StringReturnReturn a predicate that checks if the pattern is found in the tested string.Return a predicate that checks if the pattern is looking at in the tested string.Return a predicate that checks if the pattern is matched at in the tested string.Return a stream with matches in the current stringFind the given pattern in the given string.Get a set of group names in the current RE.getMatcher(CharSequence string) Get a new matcher activated with the given source string.booleanReturns true if this RE matches the given string.booleanisSingle()Returns true if this RE is a single node.Match with lookingAtMatches the source string to this RE.Merge another RE with this RE.not()Reverse the meaning of this RE.Return the pattern compiled with the given flags.toString()
-
Method Details
-
asFindPredicate
-
asLookingAtPredicate
-
asMatchPredicate
-
findIn
-
findAllIn
-
append
-
append
Append the StringBuilder by finding all this matches in the given string, and using the replacement from the replacement function. For each match, this function is called with the Match. The function can then take the captured groups and calculate the replacement string. This is like a template function.If the replacement function returns null, it will be ignored
- Parameters:
sb- the builderstring- the source stringreplacement-
-
getGroupNames
-
isMatch
Returns true if this RE matches the given string.- Parameters:
string- the source string
-
isSingle
boolean isSingle()Returns true if this RE is a single node. That is a single letter, a character class, a group that is not NONE, etc. -
lookingAt
-
getMatcher
Get a new matcher activated with the given source string.- Parameters:
string- the source string
-
matches
-
merge
-
not
RE not()Reverse the meaning of this RE. This depends on the different types. If it has no meaning, it will return the original. -
toString
-
pattern
-