Last active
August 29, 2015 14:21
-
-
Save jonas-grgt/be6023b63234f89029ce to your computer and use it in GitHub Desktop.
Extract Regexp named group candidates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Set<String> getNamedGroupCandidates(String regex) { | |
Set<String> namedGroups = new TreeSet<>(); | |
Matcher m = Pattern.compile("\\(\\?<([a-zA-Z0-9]*)>").matcher(regex); | |
while (m.find()) { | |
namedGroups.add(m.group(1)); | |
} | |
return namedGroups; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment