Package uk.ac.ebi.utils.regex
Class RegEx
java.lang.Object
uk.ac.ebi.utils.regex.RegEx
An helper class for the regex library. Easier calls to the RE functions, plus
caching of the pattern, which may speed up your code.
- Author:
- brandizi, copied from the library org.brandizi.jutils.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates and store a new Pattern, callingPattern.compile(String)Creates and store a new Pattern, callingPattern.compile(String, int) -
Method Summary
Modifier and TypeMethodDescriptionString[]groups(CharSequence input) Returns all the groups in the input, see Java documentation for detailsmatcher(CharSequence input) Gets a new matcher for the input sequencebooleanmatches(CharSequence input) <C extends Collection<? extends CharSequence>>
booleanmatchesAny(C inputs) Matches multiple strings.booleanmatchesAny(CharSequence... inputs) Matches multiple strings.static booleanmatchesAny(String target, Pattern... patterns) Matches the string against any of the patterns, returns true at the first pattern that matchesstatic RegExstatic RegExThis returns a RegEx that is cached, together with its compiled pattern.toString()
-
Constructor Details
-
RegEx
Creates and store a new Pattern, callingPattern.compile(String) -
RegEx
Creates and store a new Pattern, callingPattern.compile(String, int)
-
-
Method Details
-
matcher
Gets a new matcher for the input sequence -
groups
Returns all the groups in the input, see Java documentation for details -
matches
-
matchesAny
Matches multiple strings. TODO: tests -
matchesAny
Matches multiple strings. TODO: tests -
getPattern
-
matchesAny
Matches the string against any of the patterns, returns true at the first pattern that matches -
toString
-
of
This returns a RegEx that is cached, together with its compiled pattern. Caching is a very good idea when you need to reuse the same pattern many times, since compiling RE patterns is rather time-consuming. -
of
-