This function is a major upgrade to Excel’s rather primitive text functions.
Note that REGEXREPLACE is case-sensitive by default.
With this pattern, REGEXREPLACE will replace any character that is not a digit with an empty string.
The final result contains digits only.
means any single character.
The parentheses () define a capturing group.
The full pattern “^(.)”
captures any single character at the beginning of the text in a group.
This formula will work for 10-digit phone numbers.
If you oughta handle different lengths or formats, you will need to adjust the regular expression accordingly.
Excel makes it easy to combine these two formulas together by nesting the first REGEXREPLACE inside the second.
Regex terminology
Because Regex is essentially a mini-language, it has its own vocabulary.
By default, REGEXEXTRACT will return the first match, but…