Skip to content

Instantly share code, notes, and snippets.

@GMadorell
Created October 22, 2013 13:24
Show Gist options
  • Select an option

  • Save GMadorell/7100730 to your computer and use it in GitHub Desktop.

Select an option

Save GMadorell/7100730 to your computer and use it in GitHub Desktop.
Get values inside parenthesis in a String.
// http://stackoverflow.com/questions/14584018/how-can-i-get-inside-parentheses-value-in-a-string
String example = "United Arab Emirates Dirham (AED)";
Matcher m = Pattern.compile("\\(([^)]+)\\)").matcher(example);
while(m.find()) {
System.out.println(m.group(1));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment