title: Remove substring from string between special characters in R
body: <p>I was looking for an answer but I failed. My question is a bit peculiar and I'm still learing regex. I'd like to achieve, from this:</p>
  
  <pre><code>str1 &lt;- 'txt1/txt2/123|abc_def_123|1991-02-11'
  </code></pre>
  
  <p>something like this:</p>
  
  <pre><code>txt1|abc_def_123|1991-02-11
  </code></pre>
  
  <p>so everything from <code>/</code> (included) to first occurence of <code>|</code> should be removed.
  So far I wrote this one:</p>
  
  <pre><code>sub("\\/.*\\|", "|", str1 )
  </code></pre>
  
  <p>but it removes everything to the last occurence of <code>|</code></p>
  
  <pre><code>"txt1|1991-02-11"
  </code></pre>
  
  <p>How can I point out that the substring should be removed to he first occurence of <code>|</code>?</p>