title: Extract matching addresses using Google Sheets Re2 regular expression syntax
body: <p>I am trying to extract all cell/range addresses appear with in a formula in a Google Sheets cell.</p>
  <p>Formulas by nature might be very complicated. I tried many patterns, that works in web testers, but not on google sheets re2.</p>
  <p>The following example shows two issues. Maybe I misreading the matching results, but as I understand the are 4 Matches.</p>
  <p><strong>Formula (ignore the logic):</strong></p>
  <pre><code>=A$13:B4+$BC$12+$DE2+F2:G2
  </code></pre>
  <p><strong>Regex:</strong></p>
  <pre><code>((\$?[A-Z]+\$?\d+)(:(\$?[A-Z]+\$?\d+))?)
  </code></pre>
  <p><strong>Expected result:</strong></p>
  <pre><code>[A$13:B4,$BC$12,$DE2,F2:G2]
  </code></pre>
  <p><a href="https://regex101.com/r/G3WGXp/1" rel="nofollow noreferrer">Here</a> (if I am not misreading the results) it looks OK.
  I am not sure if the <em>group matching</em> displayed are also considered as matches as it is stated <strong>&quot;4 matches, 287 steps&quot;</strong></p>
  <p>However in google sheets returns all <em>Match 1</em> results</p>
  <pre><code>[A$13:B4,A$13,:B4,B4]    
  </code></pre>
  <p>The other matches are ignored
  So I guess the question is how to convert the regex to re2 syntax?</p>
  <p><strong>Update:</strong>
  Following player0 comments, maybe I was not clear.
  This is only a simple example, to isolate other issues I have. This one is just a string containing addresses in few relative and absolute formats.
  However, I am looking for a wider general solution that will fit any possible formulas that might contain formulas and references to other sheets. For example:</p>
  <pre><code>=(STDEVA(Sheet1!B2:B5)+sum($A$1:$A$2))*B2
  </code></pre>
  <p>Expected results here is <code>Sheet1!B2:B5,$A$1:$A$2,B2</code></p>
  <p>This formula contains two formulas and reference to another sheet.
  Still ignoring here from Named Ranges and other formula possible references that I am currently can not think of.
  Also, the square brackets <strong>[]</strong> are irrelevant, it was just way to display the results, and actually is copied from Logs as it is all done within a script.</p>