FxFormula Drills

Premium Google Sheets drill · Text and regular expressions

REGEXREPLACE a phone down to digits

Practice Google Sheets REGEXREPLACE to strip every non-digit from a phone number while keeping the digit text.

A2 is a phone number with parentheses, spaces, and a hyphen. REGEXREPLACE swaps every match for new text.

In B2, replace every character that is not a digit with an empty string.

Dataset

Starter sheet. Cells marked formula are where the formula goes.

Starter sheet for this exercise
RowAB
1Phone
2(512) 555-0198Formula goes in B2. formula

Hint

The pattern [^0-9] means any character that is not a digit from 0 to 9.

Explanation

Parentheses, spaces, and the hyphen all match [^0-9] and are removed. The digits stay text, so 5125550198 is not converted by SPLIT-style number parsing.

The interactive sheet and a worked solution are part of Formula Drills Premium. The instructions and starter data on this page are the full problem.

Solve this drill

Practice this formula

Loading the practice grid…

Google Sheets is a trademark of Google LLC. Formula Drills is not affiliated with Google. Excel drills on this site are a separate track.