How to replace particular substring using regular expression using java?
<p>I have a string as below.</p>

<pre><code>$Trap:com.oss.Event(description  matches  "abc") 
</code></pre>

<p>In the above string the generic portions is <code>$Trap:com.oss.Event(&lt;Any string&gt;)</code>.</p>

<p>when i encounter the above string i need to replace with the below string.</p>

<pre><code>$Trap:com.oss.Event(description  matches  "abc") from entry-point "EventStream".
</code></pre>

<p>To achieve the above i am using the following logic in java.</p>

<pre><code>String stmt= $Trap:com.oss.Event(description  matches  "abc")

if(stmt.matches(".*\\.Event(.*).*")&amp;&amp; s.equals(""))
{
                stmt+=" from entry-point "+"ABCStream";
}
</code></pre>

<p>But the above logic is not working as expected when the string is as below.</p>

<pre><code>stmt="$Trap:com.oss.Event(description matches "abc") or $Trap:com.oss.Event(description matches  "cde");
</code></pre>

<p>I need to generate the following corresponding string using regular expression.</p>

<pre><code>$Trap:com.oss.Event(description matches "abc") from entry-point "ABCStream" or $Trap:com.oss.Event(description matches  "cde") from entry-point "ABCStream"
</code></pre>

<p>Please provide some pointers to achieve the same.</p>
