你的正则表达式将是这样的:
data.replaceAll("\\(.*?\\)", "()"); //if you want to keep the brackets
Run Code Online (Sandbox Code Playgroud)
要么
data.replaceAll("\\(.*?\\)", ""); //if you don't want to keep the brackets
Run Code Online (Sandbox Code Playgroud)
该字符串由3部分组成:
\\( //This part matches the opening bracket
.*? //This part matches anything in between
\\) //This part matches the closing bracket
Run Code Online (Sandbox Code Playgroud)
我希望这有帮助