Package org.dspace.app.util
Class RegexPatternUtils
- java.lang.Object
-
- org.dspace.app.util.RegexPatternUtils
-
public class RegexPatternUtils extends Object
Utility class useful for check regex and patterns.- Author:
- Vincenzo Mecca (vins01-4science - vincenzo.mecca at 4science.com)
-
-
Field Summary
Fields Modifier and Type Field Description static PatternPATTERN_REGEX_INPUT_VALIDATORstatic StringREGEX_FLAGSstatic StringREGEX_INPUT_VALIDATOR
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PatterncomputePattern(String regex)Computes a pattern starting from a regex definition with flags that uses the standard format:/{regex}/{flags}(ECMAScript format).
-
-
-
Field Detail
-
REGEX_INPUT_VALIDATOR
public static final String REGEX_INPUT_VALIDATOR
- See Also:
- Constant Field Values
-
REGEX_FLAGS
public static final String REGEX_FLAGS
- See Also:
- Constant Field Values
-
PATTERN_REGEX_INPUT_VALIDATOR
public static final Pattern PATTERN_REGEX_INPUT_VALIDATOR
-
-
Method Detail
-
computePattern
public static final Pattern computePattern(String regex) throws PatternSyntaxException
Computes a pattern starting from a regex definition with flags that uses the standard format:/{regex}/{flags}(ECMAScript format). This method can transform an ECMAScript regex into a javaPatternobject wich can be used to validate strings.
If regex is null, empty or blank a nullPatternwill be retrieved If it's a valid regex, then a non-nullPatternwill be retrieved, an exception will be thrown otherwise.- Parameters:
regex- with format/{regex}/{flags}- Returns:
Patternregex pattern instance- Throws:
PatternSyntaxException
-
-