title: Struggling with removing words based on pattern (text analysis in R)
body: <p>I'm new to text analysis. I have been struggling with a particular problem in R this past week. I am trying to figure out how to remove or replace all variations of a word in a string. For example, if the string is:</p>
  
  <pre><code>test &lt;- c("development", "develop", "developing", "developer", "apples", "kiwi")
  </code></pre>
  
  <p>I want the end output to be:</p>
  
  <pre><code>"apples", "kiwi"
  </code></pre>
  
  <p>So, basically, I'm trying to figure out how to remove or replace all words beginning with "^develop". I have tried using str_remove_all in the stringr package using this expression:</p>
  
  <pre><code>str_remove_all(test, "^dev")
  </code></pre>
  
  <p>But the end result was this:</p>
  
  <pre><code>"elopment", "elop", "eloping", "eloper", "apples", "kiwi"
  </code></pre>
  
  <p>It only removed parts of the word that matched the beginning expression "dev", whereas I want to remove the entire word if it matches the beginning of "dev". </p>
  
  <p>Thanks!</p>