title: Replace all occurrences in a String by using regex in groovy
body: <p>When there are only one occurrence my code works:</p>
  
  <pre><code>def result = "Text 1,1"
  def matches = (result =~ /^.+\s([0-9],[0-9])$/ ).with { m -&gt; m.matches() ? result.replace(/${m[ 0 ][ 1 ]}/, 'X'+m[ 0 ][ 1 ]+'X') : result }
  assert "Text X,X" == matches
  </code></pre>
  
  <p>How can I do if my String contains several occurrences?</p>
  
  <pre><code>def result = "aaaa Text 1,1 Text 2,2 ssss"
  </code></pre>
  
  <p>Thanks</p>