Modifier and Type | Method and Description |
---|---|
static String[] |
getGroupNames(Pattern pattern)
Returns a string array of the group names of the specified
pattern . |
static String |
unescape(String regex)
Unescapes the provided regex into a form that does not contain any regular
expression syntax.
|
public static String[] getGroupNames(Pattern pattern)
pattern
.
This implementation expects the group name encoding as:
(?<name>regex)
pattern
- The Pattern
.pattern
.NullPointerException
- If pattern
is null.public static String unescape(String regex)
PatternSyntaxException
will be thrown.null
.
Examples Input Output \|
|
abc
abc
(abc)
abc
[aa][bb][cc]
abc
(a|a)(b|b)(c|c)
abc
(a|a)(b|b)(c|d)
null
regex
- The String
to unescape.null
if the specified string cannot be
parsed as a regular expression, or if it represents a regular
expression that can match multiple strings.PatternSyntaxException
- If the expression's syntax is invalid.Copyright © 2020 LibJ. All rights reserved.