Back to guide

Regex Transforms

Use regular expressions to find, replace, and extract text patterns in your spreadsheet columns — with live preview and built-in presets.

Overview

SheetTool's regex transforms go beyond simple search-and-replace by letting you use full regular expression patterns with capture groups. Choose between Replace mode (find a pattern and substitute it) and Extract mode (pull matching text into new values). Built-in presets cover common tasks like extracting emails, numbers, area codes, and domains, or removing HTML tags and extra spaces. A live preview shows how the transform will affect sample rows before you apply it.

Syntax & Reference

Replace mode
Find text matching a regex pattern and replace it with a substitution string. Use capture groups like $1, $2 to rearrange matched portions.
Extract mode
Pull the portion of text that matches the pattern into a new value, discarding everything else. Useful for isolating IDs, codes, or structured data from free-text fields.
Capture groups — (pattern)
Parentheses create capture groups. In replace mode, reference them with $1, $2, etc. In extract mode, the first capture group becomes the extracted value.
Global flag (g)
When enabled, the pattern matches all occurrences in each cell. When disabled, only the first match is affected.
Case-insensitive flag (i)
When enabled, the pattern matches regardless of letter casing.
Built-in presets
Ready-made patterns for extracting numbers, emails, area codes, and domains, plus patterns for removing HTML tags and collapsing extra whitespace.
Live preview
See how the regex transform will affect sample rows from your data before committing the change.

Examples

Extract domains from email addresses

Use the extract preset for domains or the pattern @(.+)$ to pull the domain portion from an email column for account grouping and analysis.

Pull order IDs from notes fields

Extract structured IDs like ORD-12345 from free-text notes using the pattern (ORD-\d+) in extract mode.

Remove HTML tags from descriptions

Use the built-in HTML removal preset or the pattern <[^>]+> with an empty replacement to strip tags from exported product descriptions.

Reformat phone numbers

Match (\d{3})(\d{3})(\d{4}) and replace with ($1) $2-$3 to standardize phone number formatting across a contact list.

Tips & Best Practices

  • Start with a built-in preset, then adjust the pattern once the live preview looks close to what you need.
  • Always check the preview on short, long, empty, and unusual rows before applying a regex globally.
  • Use the global flag when cells might contain multiple matches (like multiple URLs in a single notes field).
  • Combine regex extract with other transforms: extract a value first, then apply UPPERCASE or TRIM to clean the result.

Frequently Asked Questions

Do I need to know regex to use this feature?+

No. SheetTool includes built-in presets for the most common patterns (extract emails, numbers, domains, remove HTML). You can use these presets directly and adjust them if needed. The live preview helps you verify the result before applying.

What regex syntax is supported?+

SheetTool uses JavaScript regular expression syntax, which supports character classes, quantifiers, capture groups, alternation, lookahead, and lookbehind. The global (g) and case-insensitive (i) flags can be toggled in the UI.

Can I undo a regex transform?+

Yes. Like all operations in SheetTool, regex transforms are fully undoable with Ctrl+Z. The change is also tracked in the changelog.