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
ConstructorDescriptionCreates 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 sequenceboolean
matches
(CharSequence input) static boolean
matchesAny
(String target, Pattern... patterns) Matches the string against any of the patterns, returns true at the first pattern that matchesstatic RegEx
static RegEx
This 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
-
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
-