public final class RegExUtil extends Object
Constructor and Description |
---|
RegExUtil() |
Modifier and Type | Method and Description |
---|---|
static Map<String,String> |
findByGroupNames(String content,
String pattern)
Find the first match of the given pattern in the given content, returning a map of
all regex group names, with their corresponding values.
|
static Map<String,String> |
findByGroupNames(String content,
String pattern,
Set<String> groupNames)
Find the first match of the given pattern in the given content, returning a map of
all regex group names corresponding with the given list of group names,
with their corresponding values.
|
static String |
findByGroupNumber(String content,
String pattern,
int group)
Find the first match of the given pattern in the given content, returning the value for
the given group number.
|
static String |
findFirst(String content,
String pattern)
Find the first match of the given regular expression.
|
static Set<String> |
findNamedGroups(String regex)
Find the regular expression group names (defined with (?<name>...) contained in the
given regular expression.
|
public static final Set<String> findNamedGroups(String regex)
regex
- public static final Map<String,String> findByGroupNames(String content, String pattern, Set<String> groupNames)
content
- pattern
- groupNames
- public static final Map<String,String> findByGroupNames(String content, String pattern)
content
- pattern
- groupNames
- public static final String findByGroupNumber(String content, String pattern, int group)
content
- pattern
- group
- Copyright © 2013. All rights reserved.