Find & Replace
Find and replace across a block of text. Optional regex with global, case-insensitive, multiline, and dotAll flags. Live match count.
Paste text on the left.
Uses JavaScript regex syntax. In regex mode, replacement supports $1, $2, … for groups and $& for the full match.
How to use
- Paste your text on the left.
- Enter the find pattern (and replacement, if you want one).
- Toggle regex mode for advanced patterns. The match count updates live so you can sanity-check before copying.
About this tool
ShowHide
A simple search-and-replace that supports both literal and regex modes. In literal mode, the find string is escaped so special regex characters work as themselves. In regex mode, the full JavaScript regex flavor is available — including capture groups ($1, $2), backreferences, and Unicode (\u flag always on). Case-insensitive by default; toggle on case sensitivity when you need it. Multiline and dotAll flags only show in regex mode where they matter.
Literal mode exists because most find-and-replace jobs involve characters a regex engine would read as instructions. A dot matches anything, a question mark makes the preceding item optional, and parentheses group rather than appear, so searching for example.com in regex mode also matches exampleXcom. Escaping the pattern removes that whole class of surprise, and it is the mode to stay in unless you specifically want the machinery.
The replacement string has its own syntax even in literal mode, and $ is the character to watch. $& inserts the whole match, $ followed by a backtick inserts everything before it and $' everything after, and those three are special whether or not the pattern has groups. $1 inserts the first capture group when there is one and stays literal when there is not, which is why a replacement containing a dollar sign behaves differently depending on a pattern you may not have touched. A literal dollar is written $$.
The multiline flag changes only what ^ and $ mean, not whether the pattern can span lines. With it on they match at every line boundary rather than at the ends of the input, which is what you want for line-oriented edits. Matching across a newline is the dotAll flag's job, since . otherwise refuses to cross one.
Regular expressions cannot parse nested structures, which is the limit worth internalising. HTML tags, balanced brackets and quoted strings containing the delimiter are all beyond what a pattern can describe, so a replacement that works on your sample will break on the first input with a nested case in it. For those, a parser is the tool and a regex is the trap.
Frequently asked questions
How do I keep the match but wrap it in tags?
Turn on regex mode. In the replacement field use $& for the entire match, or $1, $2 for capture groups. Example: find \b\w+\b, replace <em>$&</em> to wrap every word.
Why doesn't ^ match my line starts?
By default ^ matches only the very start of the string. Turn on multiline (m flag) and ^ / $ will match line starts and ends.
Why does . not match my newlines?
By default . skips newlines. Turn on dotAll (s flag) for true 'any character' behavior.
What if my replacement contains literal $?
JavaScript's regex replace treats $ as a special character. Use $$ to insert a single literal $. The find side has no such issue — literal strings are escaped before becoming a regex.
Can I match by script or category, like 'any letter' or 'any hangul'?
Yes — the unicode flag is always on, so property escapes are available: \p{L} matches a letter in any script, \p{N} any digit, \p{Script=Hangul} Korean syllables, \p{Script=Han} CJK ideographs. On 'héllo κόσμε 123', \p{L}+ finds héllo and κόσμε and leaves the number alone, where [a-zA-Z]+ manages only h and llo. The same flag makes . match a whole code point, so it takes an emoji as one unit instead of splitting it into two halves and corrupting the output.
My regex works in another editor but is rejected here — why?
Almost always the unicode flag again, which forbids escapes that non-unicode mode quietly tolerated. a\-b compiles anywhere else and throws here, because \- is not a valid escape outside a character class — write a-b or put the dash in [ ]. A bare \p is an error too, since it now has to be \p{...}. Braces meant literally need escaping as \{ and \}. The fix is always to escape less, not more: drop the unnecessary backslash.
Related tools
Regex Tester
Test JavaScript regular expressions live with highlighted matches and replace preview.
Developer
Text Template (Mail Merge)
Write a template with {{placeholders}}, paste rows of data (CSV or JSON), and render one personalised text per row — entirely in your browser.
Text
Text Diff Viewer
Compare two pieces of text and see line-by-line or word-by-word additions and removals.
Text
Remove Line Breaks
Join wrapped lines back into clean, flowing text — strip the hard line breaks you get when copying from PDFs or emails, while keeping real paragraphs.
Text
Text Repeater
Repeat a word, line or block of text any number of times — joined by a new line, space, comma, nothing, or your own separator.
Text
CSS Text Shadow Generator (Multi-Layer)
Stack as many text-shadow layers as you want — neon glow, 3D lift, outline, long shadow — live preview plus copy-ready CSS.
Color & CSS