Package org.dspace.app.util
Class RegexPatternUtils
java.lang.Object
org.dspace.app.util.RegexPatternUtils
Utility class useful for check regex and patterns.
- Author:
- Vincenzo Mecca (vins01-4science - vincenzo.mecca at 4science.com)
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic final PatterncomputePattern(String regex) Computes a pattern starting from a regex definition with flags that uses the standard format:/{regex}/{flags}(ECMAScript format).
-
Field Details
-
REGEX_INPUT_VALIDATOR
- See Also:
-
REGEX_FLAGS
- See Also:
-
PATTERN_REGEX_INPUT_VALIDATOR
-
-
Method Details
-
computePattern
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 which 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
-