String replace for some pattern to some pattern
<p>I have a huge String where i need to replace </p>

<pre><code>Pattern A to pattern B
Pattern C to Pattern D
pattern E to pattern F
</code></pre>

<p>like 5 or 6 time i have to replace some part of the string.</p>

<p>If i do a direct string operation to replace those one by one, it takes huge Heap space.</p>

<p>Like <code>replaceAll().replaceAll().replaceALL</code></p>

<p>pattern.compile("(pattern a|patternc)"); wont he me bcoz we can only replace this types of pattern with 1 parrten x.</p>

<p>What could be a memory efficient way to do this replacement.</p>

<p>Does regex have any way to accomplish this?</p>
