=FormulaProof
1

FormulaProof · Evidence

Execution log

How a broken regex hides inside IFERROR, and what finds it

Ran
Engine
Google Sheets (live, via Sheets API v4)
Locale
en_US
Host
Windows_NT 10.0.26200 · Node v24.15.0
Result
14 of 14 as expected
Cell Formula What Google returned
B1 =IFERROR(REGEXEXTRACT("Invoice 4821","(?<=Invoice )\d+"),"")

IFERROR turns a broken pattern into a blank

The pattern uses lookbehind, which Sheets cannot parse. The cell shows nothing at all.

(empty)
B2 =IFERROR(REGEXEXTRACT("no digits here","\d+"),"")

IFERROR turns an honest no-match into the same blank

A perfectly good pattern with nothing to find. Indistinguishable from the row above.

(empty)
B3 =REGEXEXTRACT("Invoice 4821","(?<=Invoice )\d+")

the same broken pattern, unwrapped

#REF!
B4 =REGEXEXTRACT("no digits here","\d+")

the same honest no-match, unwrapped

#N/A
B5 =IFNA(REGEXEXTRACT("Invoice 4821","(?<=Invoice )\d+"),"")

does IFNA let a broken pattern through?

IFNA is documented to catch #N/A only. If #REF! passes through, IFNA is the safe wrapper.

#REF!
B6 =IFNA(REGEXEXTRACT("no digits here","\d+"),"")

does IFNA still catch an honest no-match?

(empty)
B7 =ISERROR(REGEXEXTRACT("Invoice 4821","(?<=Invoice )\d+"))

ISERROR sees a broken pattern

TRUE
B8 =ISNA(REGEXEXTRACT("Invoice 4821","(?<=Invoice )\d+"))

ISNA on a broken pattern

If this is FALSE, then #REF! is not #N/A, and ISNA can separate the two failures.

FALSE
B9 =ISNA(REGEXEXTRACT("no digits here","\d+"))

ISNA on an honest no-match

TRUE
B10 =ERROR.TYPE(REGEXEXTRACT("Invoice 4821","(?<=Invoice )\d+"))

ERROR.TYPE of a broken pattern

4 is #REF!. Established in the re2-limits run.

4
B11 =ERROR.TYPE(REGEXEXTRACT("no digits here","\d+"))

ERROR.TYPE of an honest no-match

7 is #N/A.

7
B12 =IFERROR(REGEXEXTRACT("Invoice 4821","(?<=Invoice )\d+"),IF(ERROR.TYPE(REGEXEXTRACT("Invoice 4821","(?<=Invoice )\d+"))=4,"BROKEN PATTERN","no match"))

an audit formula that names which failure happened — broken pattern

BROKEN PATTERN
B13 =IFERROR(REGEXEXTRACT("no digits here","\d+"),IF(ERROR.TYPE(REGEXEXTRACT("no digits here","\d+"))=4,"BROKEN PATTERN","no match"))

the same audit formula — honest no-match

no match
B14 =IFERROR(REGEXEXTRACT("Invoice 4821","Invoice (\d+)"),IF(ERROR.TYPE(REGEXEXTRACT("Invoice 4821","Invoice (\d+)"))=4,"BROKEN PATTERN","no match"))

the audit formula leaves a working pattern alone

The lookbehind rewritten as a capture group. This is the fix, and it returns the number.

4821

Every row above was written into a real Google Sheet and read back through the Sheets API on 2026-07-09. The case file and this log are in the repository, and the build refuses to run if they disagree.

Why this page exists

Anyone can write that lookahead does not work in Google Sheets. It is in Google's documentation, one link away, and a language model will tell you the same thing in a second.

What almost nobody does is run it. So this page is the run. Each formula above was written into a cell through the Sheets API, and the value in the third column is what came back — not what we expected, not what the documentation says, not what a model predicted.

Some rows are marked observed. Those are cases where we did not know the answer beforehand, so we measured instead of asserting. Guessing and then presenting the guess as a finding is exactly the failure mode this site was built to avoid.

If any formula here changes what it does, the log goes stale and the site refuses to build. Tell us if you find one that is wrong before we do.