Skip to main content
AllDevToolsHub
🔍

Find & Replace

100% Local

Find and replace text with plain-text or regex patterns and flag controls.

Find & Replace
3 matches
The quick brown fox jumps over the lazy dog. The …
…zy dog. The dog barked at the fox. The fox ran away quickly. It…
…he dog barked at the fox. The fox ran away quickly. It was a be…
Try:
This tool runs entirely in your browser. Your input is never uploaded, logged, or sent to AllDevToolsHub or anyone else, and it keeps working offline once the page has loaded.

Enter text and a search pattern. Switch between plain text and regex with case-sensitive and global flags.

Overview

What is Find & Replace?

Run find-and-replace on text using plain strings or regex with g/i/m flags. Preview matches with context, see counts, and use $1 capture group references.
FAQ

Frequently Asked Questions

Reference

Technical Deep Dive

DEVELOPMENT TOOLS

Find & Replace

Perform find-and-replace operations on any text using plain string matching or full regular expressions with g/i/m flags. Preview the first 10 matches with context before applying, see a match count badge, and use the Apply button to commit changes back to the input. Supports capture group references like $1.

Built for Devs

Designed by people who use these tools in production every day.

🧠

Smart Defaults

Reasonable assumptions out of the box, every assumption overridable when you need it.

🚀

Workflow-Friendly

Pairs with your IDE, CI, and code review, output drops into commits and PRs cleanly.

01 Engine Flag Configuration

Flag Modifier Technical Designation Execution Behavior
g (Global)Iterative MatchingContinues evaluation after first match rather than returning early.
i (Insensitive)Case NormalizationIgnores casing during literal and character-class comparisons.
m (Multiline)Boundary RedefinitionForces ^ and $ to match line breaks rather than string edges.
s (Dotall)Wildcard ExpansionPermits the . wildcard to capture newline (\n) characters.

02 Capture Group Back-References

1
Numbered Groups ($1, $2) Isolate specific sub-patterns via parentheses (pattern) and re-inject them by sequence index.
2
Named Groups ($<name>) Define logical references (?<id>pattern) for highly readable, position-independent replacements.
Contextual Injection ($&) Re-inject the entire matched string, wrapped in new formatting or tags, without declaring explicit groups.

03 Where Find & Replace Beats an IDE

An IDE handles refactoring inside a project. Find & replace shines on the loose-text territory in between, pasted snippets, copy-from-Slack content, ad-hoc files that never made it to disk. Replacement (not matching) is the verb here; regex-tester is the place to debug the pattern itself.

  • 🔧
    Rename a function across a pasted file You got a code snippet in chat and need to rename getUserData to fetchUserProfile before pasting it back. Find/replace with \b word boundaries beats clicking each occurrence.
  • 🧹
    Normalize whitespace in pasted content Collapse runs of spaces with \s+ → single space. Strip trailing whitespace with [ \t]+$ in multiline mode. Convert tabs to spaces or vice versa.
  • 📊
    Convert CSV delimiters Tab-separated to comma-separated, or pipe-delimited to TSV, in one paste. Handle quote-wrapped fields by writing a regex that ignores commas inside "..." if quoting matters.
  • 🔗
    Batch-edit markdown link references Migrate [text](old-domain.com/path) to [text](new-domain.com/path) across a markdown document, preserving the link text and path via capture groups.
  • 🎯
    Replace, don't just match If you only need to see what matches, use the regex tester. Find & replace is for committing the transformation, back-references, case-flipping replacements, and bulk substitutions.

04 Worked Examples

EXAMPLE 1 · REGEX BACK-REFERENCES
Pattern / replacement:
Find:    (\w+)\.com

Replace: https://$1.com


Input → Output:

Visit example.com or acme.com

Visit https://example.com or https://acme.com

The captured group $1 is re-injected into the replacement. Named groups work too: (?<host>\w+).comhttps://$<host>.com.




EXAMPLE 2 · CASE-PRESERVING REPLACE

Two passes, one ordering matters:

Pass 1 (case-sensitive):  Foo → Bar
Pass 2 (case-sensitive): foo → bar

Input → Output:

Foo bar and foo and FOO
↓ (after both passes)
Bar bar and bar and FOO

A single case-insensitive replace destroys casing. Two case-sensitive passes preserve it for the common Title/lower split. FOO stays untouched here because we did not write a third pass for it, add one if needed.




EXAMPLE 3 · DOTALL VS MULTILINE

Same pattern, different flags:

Pattern: <p>.*?</p>
Flags: gs (dotall: . matches newlines)
Flags: gm (multiline: ^/$ match line edges, . does NOT cross lines)

Behavior:

// gs flag: matches a <p> that spans multiple lines
// gm flag without s: matches only single-line <p> tags

The s (dotall) flag changes what . matches; the m (multiline) flag changes what ^/$ match. They are independent, pick based on whether your data crosses newlines.




05 Related Tools

Find & replace is one half of the regex toolkit. These cover the other half: building, testing, and transforming text.

You Might Also Need