title: R : How to search for a regex in a vector over elements outwardly?
body: <p>Is it possible in R to search for a regex in a vector as if all the elements are a collapsed single element? If we collapse all the elements into one to do this, it becomes impossible to put them back to their element-wise form after the search.</p>
  
  <p>here is a vector.</p>
  
  <pre><code>vector&lt;-c("I", "met", "a", "cow")
  </code></pre>
  
  <p>now, the search word is "meta" (elements 2 and 3 collapsed).</p>
  
  <p>Let's say my task is to merge the two elements across which the search string lies.</p>
  
  <p>So what I expect is this:</p>
  
  <pre><code>vector = "I", "meta", "cow"
  </code></pre>
  
  <p>Is it possible to do this? Please help.</p>