Package org.openstreetmap.josm.tools
Class PatternUtils
- java.lang.Object
-
- org.openstreetmap.josm.tools.PatternUtils
-
public final class PatternUtils extends java.lang.Object
A class that caches compiled patterns.- Since:
- 18475
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.commons.jcs3.access.CacheAccess<java.lang.String,java.util.regex.Pattern>
cache
A cache for Java Patterns (no flags)private static java.lang.String
MAGIC_STRING
A string that is highly unlikely to appear in regexes to split a regex from its flags
-
Constructor Summary
Constructors Modifier Constructor Description private
PatternUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.regex.Pattern
compile(java.lang.String regex)
Compile a regex into a pattern.static java.util.regex.Pattern
compile(java.lang.String regex, int flags)
Compile a regex into a pattern.
-
-
-
Field Detail
-
MAGIC_STRING
private static final java.lang.String MAGIC_STRING
A string that is highly unlikely to appear in regexes to split a regex from its flags- See Also:
- Constant Field Values
-
cache
private static final org.apache.commons.jcs3.access.CacheAccess<java.lang.String,java.util.regex.Pattern> cache
A cache for Java Patterns (no flags)
-
-
Constructor Detail
-
PatternUtils
private PatternUtils()
-
-
Method Detail
-
compile
public static java.util.regex.Pattern compile(java.lang.String regex)
Compile a regex into a pattern. This may return aPattern
used elsewhere. This is safe.- Parameters:
regex
- The regex to compile- Returns:
- The immutable
Pattern
. - See Also:
Pattern.compile(String)
-
compile
public static java.util.regex.Pattern compile(java.lang.String regex, int flags)
Compile a regex into a pattern. This may return aPattern
used elsewhere. This is safe.- Parameters:
regex
- The regex to compileflags
- The flags fromPattern
to apply- Returns:
- The immutable
Pattern
. - See Also:
Pattern.compile(String, int)
-
-