title: Java change text between two substrings
body: <p>Assume I have this string:</p>
  
  <pre><code>String s = "random text blah blah &lt;change&gt;hello&lt;/change&gt; more random text &lt;change&gt;hey&lt;/change&gt; ..";
  </code></pre>
  
  <p>And I want to change the values between the <code>&lt;change&gt;</code> and <code>&lt;/change&gt;</code> elements (I want to encode them, or decode them, it's just an example in this case, note that to encode these values, I need the value between the tags (before the changement) itself too).</p>
  
  <p>What's the best way to do this?
  I was thinking about using the s.replaceAll() function but I'm not sure how I can use it for this example.</p>
  
  <p>I can't just use an XML parser because the text between the tags might contain some special characters like &lt; and >, that will cause errors when using an XML parser.</p>
  
  <p>I'm using Java.</p>