Use regular expressions

Use copyable examples to find text, numbers or empty cells. No previous experience with regular expressions is needed.

Use RegEx for the first time

A regular expression, or RegEx, is a search pattern. It can find empty cells or product codes with a particular structure. For a simple name, ordinary text search is usually enough.

  1. Open search with ⌘F.
  2. Enable the .* button.
  3. If possible, choose the column you want to search.
  4. Copy a pattern below into Find, without the surrounding code formatting. Do not add slashes /…/.
  5. Check the highlighted cells. Use the arrows to move between matches.
  6. Click Find and Select if you want to check the matching rows.

Each cell is checked separately. A pattern does not search across columns or table rows. Aa distinguishes uppercase and lowercase letters; with Aa off, Berlin and berlin are treated alike. Automatic selection always skips the header row. Other rows remain visible.

Searching does not change your data. Only Replace or Replace All applies a replacement.

Find specific text, beginnings and endings

An exact cell value

Find: \ABerlin\z

Matches Berlin, but not Berlin Mitte. \A means the start of the cell and \z its end. Spaces are part of the value: Berlin does not match.

Either of two values

Find: \A(Berlin|Zürich)\z

Matches Berlin or Zürich, but not Zürich West. The vertical bar | means “or”.

A particular beginning

Find: \ARE-

Matches RE-1042, but not ALT-RE-1042.

A particular ending

Find: @example\.com\z

Matches anna@example.com, but not anna@example.com.ch. This checks only the ending, not whether the entire email address is valid.

Find numbers and product codes

Digits only

Find: \A[0-9]+\z

Matches 123 and 0012, but not 12a, -12 or an empty cell. [0-9] means a digit; + means one or more of them.

A simple number with an optional minus sign and decimal part

Find: \A-?[0-9]+([.,][0-9]+)?\z

Matches 12, -12, 12,50 and 12.50. Does not match CHF 12, 1 234,50 or 1.234,50. A ? makes the preceding part optional. This pattern is intended for numbers without thousands separators; 1.234 is treated as a decimal number.

A product code with a fixed structure

Find: \A[A-Z]{2}-[0-9]{4}\z

Matches AB-0123, but not A-123 or AB-12345. {2} means exactly two characters and {4} exactly four. Enable Aa if only uppercase letters are allowed. With Aa off, ab-0123 also matches.

Find empty cells and unwanted spaces

A completely empty cell

Find: \A\z

Matches an empty value, but not a cell containing a space. Choose a particular column and click Find and Select, for example to check rows without a customer number. A cell that is entirely absent from a shorter CSV row is not searched.

Empty or containing only whitespace

Find: \A\s*\z

Matches empty cells and cells containing only spaces, tabs or line breaks. \s means such whitespace characters; * also allows zero of them. Text does not match.

Ordinary spaces at the edges

Find: \A[ ]+|[ ]+\z

Matches the spaces in Berlin , but not the single space inside Berlin Mitte. To remove them, leave Replace with empty. Try Replace on one match first. For whitespace, the whole-cell highlight may be easier to see than the invisible character itself.

Find periods and other special characters

Some characters have a special meaning in RegEx. For example, a period . stands for any character except a line break. Put a backslash \ before it to search for the character itself.

  • Find: \. matches the period in 12.50, but not the comma in 12,50.
  • Find: \(alt\) matches (alt) in Name (alt), but not just alt.
  • Find: \+ matches the plus sign in A+B.

The characters *, ?, [, ], (, ), {, }, ^, $, | and \ also have special roles. To find text containing these characters literally, turn off .*. Enter each backslash only once in the search field, for example \..

Find line breaks inside a cell

Find: \r\n|\r|\n

Matches a line break inside a cell, for example between a street and city in a multiline address. It does not match the normal boundaries between table rows.

To replace the matched line break with a space, enter exactly one space in Replace with. An entirely empty replacement would join the text without a gap. Try the change on one match first.

Reformat a date: reuse matched parts

Parentheses can capture parts of a match. In the replacement, $1 inserts the first group, $2 the second, and so on.

Example: turn 2026-10-13 into 13.10.2026.

  1. Choose the date column and enable .*.
  2. Find: \A([0-9]{4})-([0-9]{2})-([0-9]{2})\z
  3. Replace with: $3.$2.$1
  4. Check a match and click Replace.
  5. If the result is correct, you can use Replace All.

The first group holds the year, the second the month and the third the day. This pattern only reformats the text; it does not check whether the date is valid. 13.10.2026 and 2026-1-3 do not match the search pattern.

Checked rows do not limit replacement. The column choice and header option define its scope. Use ⌘Z to undo a replacement; Replace All can also be undone as a single step.

When a pattern does not work as expected

  • First check that .* is enabled and the correct column is selected.
  • Turn off Aa to treat uppercase and lowercase letters alike.
  • Copy the whole pattern. Missing parentheses or backslashes can change its meaning or cause an error.
  • An empty search field does not run a search. To find empty cells, use \A\z.
  • The match counter counts occurrences, not rows. A row can have several matches but still receive only one checkmark.
  • After changing the pattern, click Find and Select again to update the checkmarks.
  • An invalid pattern changes neither data nor the existing selection. A valid pattern with no matches clears the checkmarks when you select matches.

If you are unsure, start with ordinary text search and .* turned off. Find and review matches first; you do not need a replacement to find or select.