OhMyApps
Back to Blog
Tools Text Find Replace Regex Tutorial

Find and Replace: Search Text with Regex Support

3 min read By OhMyApps

Find and replace is one of the most common text operations. Whether you’re cleaning up data, renaming variables, or reformatting content, a powerful find and replace tool with regex support makes the job easy.

Plain Text vs Regex

Plain Text Mode

Simple string matching. Type exactly what you want to find:

  • Find: color → Replace: colour — changes all instances of “color” to “colour”
  • Find: (two spaces) → Replace: (one space) — collapses double spaces

Regex Mode

Regular expressions let you match patterns, not just literal strings:

  • Find: \d{3}-\d{4} — matches phone number patterns like “555-1234”
  • Find: \b\w+@\w+\.\w+\b — matches email-like patterns
  • Find: ^#\s+ → Replace: ## — converts H1 headers to H2

Common Regex Patterns

PatternMatchesExample
\d+One or more digits”123”, “42”
\w+Word characters”hello”, “foo_bar”
\s+Whitespacespaces, tabs, newlines
^Start of line^Hello matches “Hello world”
$End of lineworld$ matches “Hello world”
.+Any charactersMatches everything
(group)Capture groupUse $1 in replacement

Using Capture Groups

Regex capture groups let you rearrange matched text:

Swap first and last name:

  • Find: (\w+)\s+(\w+)
  • Replace: $2, $1
  • “John Doe” → “Doe, John”

Add quotes around words:

  • Find: (\w+)
  • Replace: "$1"
  • hello world"hello" "world"

How to Use Our Find and Replace Tool

  1. Enter the search pattern in the “Find” field
  2. Enter the replacement text in the “Replace with” field
  3. Paste your text in the input area
  4. View the result with replacements applied instantly

Options

  • Case sensitive — match exact case (default: case insensitive)
  • Use regex — enable regular expression matching
  • Replace all — replace every match (default: on). Uncheck to replace only the first match

Tips

  • The match count badge shows how many matches were found
  • Results update in real time as you change the find/replace values
  • When using regex, the replacement field supports $1, $2 for capture groups
  • If the regex is invalid, the tool shows “Invalid regex” instead of crashing

Try our free Find and Replace tool to search and replace text patterns instantly.

Try Ghost Image Hub

The Chrome extension that makes managing your Ghost blog images a breeze.

Learn More