How can I get inside parentheses value in a string?
String str= "United Arab Emirates Dirham (AED)";
I need only AED text.
Using regular expression:
String text = "United Arab Emirates Dirham (AED)"; Pattern pattern = Pattern.compile(".* \\(([A-Z]+)\\)"); Matcher matcher = pattern.matcher(text); if (matcher.matches()) { System.out.println("found: " + matcher.group(1)); }