regex to remove substring and other characters
<p>I have the following string </p>

<pre><code>var myName = 'names:(taga || tagb || tagc)'
</code></pre>

<p>and this regex to remove names: parentheses</p>

<pre><code>  myName = myName.replace(/(names:)?\s*\(?([^)]*)(\)$)?/, '$2').trim(); 
</code></pre>

<p>and the output of the myName is : <code>taga||tagb||tagc</code></p>

<p>and I have another</p>

<pre><code>var myName2 = 'names:tag1names: || names:tag2 || names:tag3'
</code></pre>

<p>and i want to return : <code>tag1names:||tag2||tag3</code>, but it returns <code>tag1names:||names:tag2||names:tag3</code></p>

<p>Can I have the regex to remove the first <strong>names</strong> of each string before ||  so it works for both cases</p>

<p>both input strings:</p>

<pre><code>'names:(taga || tagb || tagc)' -&gt; return taga||tagb||tagc
'names:tag1name: || names:tag2 || names:tag3' -&gt; return tag1name:||tag2||tag3
</code></pre>