Package com.blackrook.rookscript.struct
Class PatternUtils
java.lang.Object
com.blackrook.rookscript.struct.PatternUtils
A caching structure for all RegEx patterns.
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.
- Author:
- Matthew Tropiano
-
Method Summary
-
Method Details
-
get
Gets an existing, compiled pattern or a newly-compiled one for the provided expression. Also useful for pre-warming oft-used expressions.- Parameters:
regex
- the input RegEx.- Returns:
- a newly-compiled
Pattern
or an existing one. - Throws:
PatternSyntaxException
- if the expression cannot be compiled.
-