title: Remove evey substring after a given character in a list
body: <p>I have a list that has the following structure:</p>
  <p><code>[1] &quot;Atp|Barcelona|Concentration(ng/mL)|8|FALSE&quot;</code></p>
  <p>I want to extract the third element (separating by the <code>|</code> symbol, and removing for the given string everything that is after the <code>(</code> symbol.</p>
  <p>So I would get this character:</p>
  <p><code>[1] &quot;Concentration&quot;</code></p>
  <p>What I do is first split by the <code>|</code> symbol. Then, get the third element of the generated list.
  In order to be able to use gsub I convert to character, and then I apply gsub function, like follows.</p>
  <pre><code>y &lt;- &quot;Atp|Barcelona|Concentration(ng/mL)|8|FALSE&quot;
  y &lt;- strsplit(y,  &quot;\\|&quot;)
  y &lt;- y[[1]][3]
  y &lt;- as.character(y)
  gsub(&quot;(.*&quot;,&quot;&quot;,y)
  </code></pre>
  <p>However, this error is prompted:</p>
  <pre><code>invalid regular expression '(.*', reason 'Missing ')''
  </code></pre>