How to remove the duplicated part of string by comparing two string in Jquery or Javascript
<pre><code>$str1='&lt;option value="AAA"&gt;AAA&lt;/option&gt;&lt;option value="BBB"&gt;BBB&lt;/option&gt;&lt;option value="CCC"&gt;CCC&lt;/option&gt;';

$str2='&lt;option value="CCC"&gt;CCC&lt;/option&gt;&lt;option value="DDD"&gt;DDD&lt;/option&gt;';
</code></pre>

<p>I would like the expected result as following. If some part of <code>$str2</code> which is duplicated with part of <code>$str1</code>, then removing the duplicated part of $str2.</p>

<p>Expected result:</p>

<pre><code>$expectedStr = '&lt;option value="DDD"&gt;DDD&lt;/option&gt;';
</code></pre>

<p>Can anyone help me?</p>
