Package org.opennms.core.utils
Class RegexUtils
- java.lang.Object
-
- org.opennms.core.utils.RegexUtils
-
public class RegexUtils extends Object
Utility functions for regular expression patterns.
-
-
Constructor Summary
Constructors Constructor Description RegexUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Set<String>
getNamedCaptureGroupsFromPattern(String pattern)
Extracts the names of the named capture groups found within a regex.
-
-
-
Method Detail
-
getNamedCaptureGroupsFromPattern
public static Set<String> getNamedCaptureGroupsFromPattern(String pattern)
Extracts the names of the named capture groups found within a regex. This function may return false positives, so you must ensure to guard against IllegalArgumentExceptions when callingMatcher.group(String)
. Derived from https://stackoverflow.com/questions/15588903/get-group-names-in-java-regex The returnedSet
preserves the order of capture groups as found in the pattern.- Parameters:
pattern
- the pattern from which to extract the named capture groups- Returns:
- an ordered list of named capture group candidates
-
-