public final class PatternCache
extends java.lang.Object
RegExs, when compiled into Pattern
s, can be reused several times.
This cache is for automatic building/returning existing patterns by String.
All operations are thread-safe.
Modifier and Type | Method and Description |
---|---|
static java.util.regex.Pattern |
get(java.lang.String regex)
Gets an existing, compiled pattern or a newly-compiled one for the provided expression.
|
public static java.util.regex.Pattern get(java.lang.String regex)
regex
- the input RegEx.Pattern
or an existing one.java.util.regex.PatternSyntaxException
- if the expression cannot be compiled.