title: lookbehind in str_extract with R
body: <p>I have the following text file </p>
  
  <pre><code>[01/29/14 16:42:55, 10.100.120.120, unknown]: spatial_monitor: Alan entered Conference Room (Zone Role contains Person role)
  [01/29/14 16:42:57, 10.100.120.120, unknown]: spatial_monitor: Alan left Conference Room (Zone Role contains Person role)
  [01/29/14 16:43:00, 10.100.120.120, unknown]: spatial_monitor: Kurt entered Conference Room (Computer desk contains Person role)
  [01/29/14 16:43:02, 10.100.120.120, unknown]: spatial_monitor: Kurt left Conference Room (Computer desk contains Person role)
  [01/29/14 16:43:03, 10.100.120.120, unknown]: spatial_monitor: Alan entered Conference Room (Zone Role contains Person role)
  [01/29/14 16:43:08, 10.100.120.120, unknown]: spatial_monitor: Alan left Conference Room (Zone Role contains Person role)
  [01/29/14 16:46:07, 10.100.120.120, unknown]: spatial_monitor: Fred entered Conference Room (Zone Role contains Person role)
  [01/29/14 16:46:08, 10.100.120.120, unknown]: spatial_monitor: Fred left Conference Room (Zone Role contains Person role)
  </code></pre>
  
  <p>I am trying to use str_extract in R (in library stringr) to extract the names of locations ("Conference Room" in example above). The logic is to pull the portion of string which follows the words "entered" or "left". To this end, i have the following regular expression</p>
  
  <pre><code>(?&lt;=entered\s)[A-Z][a-z]+\s[A-Z][a-z]+
  </code></pre>
  
  <p>This works fine in Notepad++, however when i embed this in R, i get the following error </p>
  
  <pre><code>&gt; tt &lt;- "[01/29/14 16:42:55, 10.100.120.120, unknown]: spatial_monitor: Alan entered Conference Room (Zone Role contains Person role)"
  &gt; str_extract(tt, '(?&lt;=entered\\s)[A-Z][a-z]+\\s[A-Z][a-z]+')
  Error in regexpr("(?&lt;=entered\\s)[A-Z][a-z]+\\s[A-Z][a-z]+", "[01/29/14 16:42:55, 10.100.120.120, unknown]: spatial_monitor: Alan entered Conference Room (Zone Role contains Person role)",  : 
    invalid regular expression '(?&lt;=entered\s)[A-Z][a-z]+\s[A-Z][a-z]+', reason 'Invalid regexp'
  </code></pre>
  
  <p>Other answers tell me that <a href="https://stackoverflow.com/questions/13420391/why-is-this-regex-using-lookbehinds-invalid-in-r">lookahead and lookbehind only work with Perl</a>. So the question is how to enable Perl with str_extract? Or is there a better way of doing this? Thanks in advance.</p>