title: Extract a string between two words, with multiple patterns
body: <p>I have a series of strings like &quot;the appointment of XX as head&quot;, &quot;appoints YY as head&quot; (included in a data frame labelled &quot;df&quot; in a column labelled &quot;title&quot;)</p>
  <p>I want to extract the names XX, XY enclosed between the two different expressions.</p>
  <p>I'm currently using the following:</p>
  <pre><code>df$name &lt;- df$title %&gt;% 
    str_extract(regex(pattern = &quot;(?&lt;=Appointment of).*(?= as)&quot;, ignore_case=TRUE))
  </code></pre>
  <p>However, that works with only one of the two possible patterns.</p>
  <pre><code>df$name &lt;- df$title %&gt;% 
    str_extract(regex(pattern = &quot;(?&lt;=Appointment of).*(?= as)&quot;|&quot;(?&lt;=joins).*(?= as)&quot;, ignore_case=TRUE))
  </code></pre>
  <p>which of course does not work.
  How can I create multiple patterns to feed into str_extract?</p>
  <p>Happy to provide further details if needed!</p>
  <p>Thanks a lot</p>