I want to get the data from String "Max(percentage(%))" or "Max(percentage)", what i need to get is "percentage(%)" or "percentage" in the brackets. I want to use one regex achieve the goal. Can someone help me? Below is my code:
String str = "Max(percentage)";
Pattern pattern = Pattern.compile("(?<=\\()(.+?)(?=\\))");
String str = "Max(percentage(%))";
Pattern pattern = Pattern.compile("(?<=\\()(.+?)(?<=\\))");