title: Fastest way to match regex in R
body: <p>I need to parse in R around 1.6k REGEX expressions such as the pair I am writing below.</p>
  
  <p>I have also around 7k documents (1/2 page long each in average) that need to be parsed according to the REGEX expressions.</p>
  
  <p>Right now I am using</p>
  
  <pre><code>library(rebus)
  library(stringr)
  
  regex_exp &lt;- rebus::or1("(?i-mx:\\b(?:actroid\\b))", "(?i-mx:\\b(?:robot\\*w\\b)))")
  
  regex_exp &lt;- BOUNDARY %R% regex_exp %R% BOUNDARY
  
  stringr::str_extract_all("This is my text talking about technology, but also about the actroid", regex_exp)
  </code></pre>
  
  <p>to found matches, but it takes approx. 3.5 minutes per file, which is of course not scalable.</p>
  
  <p>Is there a more efficient library/method to parse regex expression in R? I am also naive about whether using reticulate to parse in Python and go back to R could be faster.</p>
  
  <p>According to <a href="https://rpubs.com/jonclayden/regex-performance" rel="nofollow noreferrer">this site</a>, stringi (and therefore stringr which is the vectorised implementation) is much faster that base R.</p>