Skip to main content
s/find/replace/gs/find/replace/g.*.*\b\w+\b\b\w+\b$1 โ†’ $2$1 โ†’ $2(?:regex)(?:regex)
HomeToolsRegex Find and Replace
DEVELOPER TEXT TOOL

Regex Find & Replace

๐Ÿ” Find and replace text using regex or plain text โ€” with live match highlighting, capture groups, line diff view, multi-rule mode & 20+ presets.

โœ… 100% Free๐Ÿ”“ No Login Requiredโšก Instant Preview๐Ÿ“‹ 20+ Presets
Capture Group References ($1, $2)
Multi-Rule Sequential Mode
Line-by-Line Diff View

Preset Rules โ€” Click to Load

Input Text

0 chars ยท 1 lines
//g

Use $1 $2 for capture groups ยท $& for full match ยท $$ for literal $

Enter a pattern and click Run Replacement

Supports regex and plain text ยท capture groups ยท multi-rule

What Is Regex Find and Replace?

Regex find and replace is the process of using a regular expression pattern to locate text and substitute it with something else. Unlike plain-text find and replace โ€” which can only match exact strings โ€” regex lets you describe patterns. You can match any number, any email address, any HTML tag, any repeated word, or any structure you can describe with a regular expression.

This tool brings that power directly to your browser. No code required. Paste your text, write your pattern, and get the result instantly with a full match list, line-by-line diff, and export options.

Common Use Cases

๐Ÿงน

Clean Up Exported Data

Remove extra spaces, fix line endings, strip HTML tags from copy-pasted content or database exports.

๐Ÿ“„

Reformat Text Files

Convert CSV to TSV, swap column order using capture groups, or wrap every line in quotes for code generation.

๐Ÿ”’

Redact Sensitive Information

Replace email addresses, phone numbers and URLs with placeholders before sharing documents publicly.

โš™๏ธ

Code Refactoring

Rename variables, convert camelCase to snake_case, or update import paths across a pasted code block.

โœ๏ธ

SEO and Content Editing

Find and replace specific phrases across large blocks of content, fix repeated words, normalize spacing.

๐Ÿ”„

Data Migration

Transform data from one format to another โ€” dates, phone formats, address structures โ€” before importing.

How Capture Groups Work in Replacements

Capture groups are one of the most powerful features in regex find and replace. You wrap part of your pattern in parentheses โ€” that creates a group. In your replacement string, you reference that group with $1 for the first group, $2 for the second, and so on.

For example: find <code>(w+), (w+)</code> and replace with{" "} <code>$2 $1</code>. This matches "Smith, John" and replaces it with "John Smith". The first capture group caught "Smith", the second caught "John", and the replacement put them in the opposite order.

You can also use $& to reference the entire match โ€” useful when you want to wrap every match in something, like replacing every number with [$&] to put brackets around all numbers in the text.

๐Ÿ”ง How It Works

Find and replace text with regex power โ€” instantly in your browser

1

Paste Your Text

Enter the text you want to process โ€” paste from any source, any size. Supports plain text and code.

2

Define Find & Replace

Enter your find pattern (plain text or regex) and replacement string. Use capture groups like $1 for advanced replacements.

3

Preview & Export

See matches highlighted live, review the diff line by line, then copy or download the result.

Frequently Asked Questions

Everything about regex find and replace

Do I need to sign up or log in to use this tool?

No. All QuickTextTools are completely free to use online with no login, signup, or account required.

What is the difference between plain text and regex mode?

In plain text mode, the find field is treated as a literal string โ€” special characters like dots and brackets are matched exactly. In regex mode, the find field is a regular expression where special characters have meaning. For example a dot in regex mode matches any character.

How do I use capture groups in replacements?

In regex mode, wrap parts of your pattern in parentheses to create capture groups. Reference them in the replacement with $1, $2 and so on. For example find (\w+)@(\w+) and replace with $2/$1 to swap the parts around an @ sign.

What does the global flag do?

The g (global) flag makes the replacement apply to every match in the text. Without it, only the first match is replaced. This is the most commonly needed flag and is enabled by default.

What is multi-rule mode?

Multi-rule mode lets you define multiple find-and-replace rules that are applied sequentially to your text. The output of each rule becomes the input for the next. This is useful for complex transformations that require multiple steps.

Can I use this tool to clean code or data?

Yes. The preset rules include common code and data cleaning operations โ€” removing HTML tags, converting CSV to TSV, normalizing line endings, converting camelCase to snake_case, and more. You can also write custom regex patterns for any specific transformation.

Is there a size limit on the input text?

The tool processes text in your browser so there is no server-side size limit. Very large texts may slow down the browser. For files over 1MB we recommend splitting the text into smaller sections.

What does the diff view show?

The diff view compares the original and replaced text line by line and highlights lines that changed. Lines shown in red are from the original, lines in green are the replacement. This makes it easy to review exactly what changed before copying the result.