title: Regex to match some words before and after a word gives capturing group error on BigQuery
body: <p>I have a regex that matches 5 words before and after the word <code>university</code>. But I wanted to change this regex so it may work for multiple spells of the word <code>university</code> like <code>Universidad</code> or <code>universita</code>.</p>
  <p>The regex which I'm using is
  <code>((?:(?:\b[a-zA-Z_']+\b)[ ]*){0,5}.?universidad.?(?:(?:\b[a-zA-Z_']+\b)[ ]*){0,5})</code></p>
  <p>I use this on BigQuery and it works as expected.</p>
  <p>But when I add one more group,
  <code>((?:(?:\b[a-zA-Z_']+\b)[ ]*){0,5}.?(universidad|university|universidad).?(?:(?:\b[a-zA-Z_']+\b)[ ]*){0,5})</code>
  This regex shows error -
  <code>Regular expressions passed into extraction functions must not have more than 1 capturing group</code> on BigQuery.</p>
  <p>The query which I'm using is</p>
  <pre><code>with t1 as (
    select &quot;a a a a a my university hospital of besancon&quot; as entity_name
    union all select &quot;universidad de madrid&quot;
    union all select &quot;universidad de madrid some word&quot;
    union all select &quot;university de dublin usa ireland world word&quot;
    union all select &quot;bacon university&quot;
  )
  select regexp_extract(
    entity_name, r&quot;((?:(?:\b[a-zA-Z_']+\b)[ ]*){0,5}.?universidad.?(?:(?:\b[a-zA-Z_']+\b)[ ]*){0,5})&quot;
  ) from t1
  </code></pre>
  <p>The expected results will be no nulls in all rows.</p>
  <p>If you currently replace <code>universidad</code> with <code>universita</code> or <code>university</code> then you can see all rows can be populated. But I'm finding a correct way to accumulate all types of regex into one, which I think can be possible by using a group.</p>
  <p>Any idea, how this can be resolved?</p>
  <p>If anything is unclear, let me know.</p>