I would like to ask you, java uses regular expressions to intercept strings with nested square brackets, and intercept the contents of the innermost square brackets no matter how many layers are nested, thank you!

  java, question

I would like to ask you a question about the regular interception of strings in java.
The sample string is as follows (the number of parentheses nested in the string may not be the same):
Null[null[ request service exception]]
The result is to:[Request Service Exception]
I was puzzled by this problem all afternoon. I searched the related articles on the internet and the documents, but finally I could not solve it. …
If anyone has time, please help me give some advice, thank you! ! ! Thank you! ! !

\ [([\ [\]] plus) \]

import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 public class RegexMatches {
 public static void main( String args[] ){
 String line = "null[null[ request service exception]] ";
 String pattern = "\ \ [([\ \ [\ \]] plus) \ \]";
 Pattern r = Pattern.compile(pattern);
 Matcher m = r.matcher(line);
 if (m.find()) {