title: pattern matching using regex in groovy
body: <p>I have the below groovy code</p>
  
  <pre><code>import java.util.regex.Matcher;
  import java.util.regex.Pattern;
  
  String myInput="License_All (12313)"
  String myRegex="\\(\\d+\\)"
  
  
  String ResultString
  Pattern regex
  Matcher regexMatcher
  
  regex = Pattern.compile(myRegex, Pattern.DOTALL);
  
  regexMatcher = regex.matcher(myInput);
  
  List&lt;String&gt; matchList = new ArrayList&lt;String&gt;();
  while (regexMatcher.find()) {
  matchList.add(regexMatcher.group());
  }
  
  for(int i=0;i&lt;matchList.size();i++)
  {
  myInput=myInput.replaceAll( matchList[i], '')
  println matchList[i]
  }
  println myInput
  </code></pre>
  
  <p>It is supposed to remove <code>(12313)</code> part but instead it gives me the below output</p>
  
  <pre><code>(12313)
  License_All ()
  </code></pre>
  
  <p>How do i remove all the bracket portion <code>(12313)</code>?</p>