title: Count the number of times a string appeared in a delimited field In BIGQUERY
body: <p>I have a dataset with a delimiter &quot;-&gt;&quot; like:</p>
  <pre><code>ROW 1- &quot;Q -&gt; Res -&gt; tes -&gt; Res -&gt; twet&quot;
  ROW 2- &quot;rw -&gt; gewg -&gt; tes -&gt; Res -&gt; twet&quot;
  ROW 3- &quot;Y -&gt; Res -&gt; Res -&gt; Res -&gt; twet&quot;
  </code></pre>
  <p>I just want to count the number of &quot;Res&quot; in every row</p>
  <p>Output would be:</p>
  <pre><code>ROW 1- 2
  ROW 2- 1
  ROW 3- 3
  </code></pre>
  <p>Ive tried writing the following queries but they arnt counting correctly or only counting once:</p>
  <pre><code>    countif(distinct(lower(FIELD_NAME) like '%Res%'))
  
      count(split(regexp_extract(FIELD_NAME, '(.*?)Res'), '-&gt;')) 
  
      (trim(Array_reverse(split(regexp_extract(FIELD_NAME, '(.*?)Res'),   '-&gt;')))
  
      count(regexp_extract(trim(FIELD_NAME), 'Res')) 
  
      count(regexp_contains(trim(FIELD_NAME), 'Res'))
  </code></pre>