title: Regex to dynamically replace text in java
body: <p>What I am trying to do is make something like:</p>
  
  <pre><code>some random stuff substitute("random stuff","xxx") test
  </code></pre>
  
  <p>be replaced to the following:</p>
  
  <pre><code>some xxx test
  </code></pre>
  
  <p>If I use:</p>
  
  <pre><code>substitute\((.*?)*\)
  </code></pre>
  
  <p>I get to find the portion, but what I ultimately want is multiple groups where the first group is the text to search and the second group is to replace. I want it to be generic enough so I dont depend on the <code>,</code> since it can appear anywhere. Is there a regex that could work for all cases or should I be depending on the "" to get what I need?</p>