title: Replace the first occurrence of a character within a string in R
body: <p>I am working with lots of strings. I realized I can read them using <code>read.table()</code> but I have to clean them beforehand.</p>
  
  <p>I have this general structure:</p>
  
  <pre><code>Request(123): \n Element1: 123123 \n Element2: 456456
  </code></pre>
  
  <p>I want to remove only the first time the semicolon <code>:</code> appears, but not the remaining ones.</p>
  
  <pre><code>Request(123) \n Element1: 123123 \n Element2: 456456
  </code></pre>
  
  <p>Let the first string be stored in <code>test</code>. After reading a couple of threads, I tried <code>.*</code>:</p>
  
  <pre><code>gsub(pattern = ".*:", replacement = "", x = test)
  </code></pre>
  
  <p>I know you can use a question mark to <a href="https://stackoverflow.com/questions/32767164/use-gsub-remove-all-string-before-first-white-space-in-r">make the searching "lazy"</a>, but I couldn't get it to work.</p>