title: Multiple regex matches in Google Sheets formula
body: <p>I'm trying to get the list of all digits preceding a hyphen in a given string (let's say in cell <code>A1</code>), using a Google Sheets regex formula :</p>
  
  <pre><code>=REGEXEXTRACT(A1, "\d-")
  </code></pre>
  
  <p>My problem is that it only returns the first match... <strong>how can I get <em>all matches</em>?</strong></p>
  
  <p>Example text:</p>
  
  <pre><code>"A1-Nutrition;A2-ActPhysiq;A2-BioMeta;A2-Patho-jour;A2-StgMrktg2;H2-Bioth2/EtudeCas;H2-Bioth2/Gemmo;H2-Bioth2/Oligo;H2-Bioth2/Opo;H2-Bioth2/Organo;H3-Endocrino;H3-Génétiq"
  </code></pre>
  
  <p>My formula returns <code>1-</code>, whereas I want to get <code>1-2-2-2-2-2-2-2-2-2-3-3-</code> (either as an array or concatenated text).</p>
  
  <p>I know I could use a script or another function (like <code>SPLIT</code>) to achieve the desired result, but what I really want to know is how I could get a re2 regular expression to return such multiple matches in a "<code>REGEX.*</code>" Google Sheets formula. 
  Something like the "<strong><em>g</strong>lobal - Don't return after first match</em>" option on <a href="http://regex101.com" rel="noreferrer">regex101.com</a></p>
  
  <p>I've also tried removing the undesired text with <code>REGEXREPLACE</code>, with no success either (I couldn't get rid of other digits not preceding a hyphen).</p>
  
  <p>Any help appreciated!
  Thanks :)</p>