0 lines · 0 characters
0 lines · 0 characters · 0 replacement(s)
Regex find and replace with match preview
This tool finds text and replaces it, with plain words or JavaScript regular expressions. Type what to find and what to put instead; the result and a table of every match update as you type.
Last updated:
How it works
Paste the text
Paste text, open a file or load one from a URL. "Load sample" also fills in a regex that reorders dates.
Write the rule
Enter the text or pattern to find and the replacement. Add more rules to apply several replacements in a row.
Check every match
The preview lists each match with its line, column, capture groups and replacement before you copy or download the result.
Features
Regular expressions with groups
Full JavaScript syntax with Unicode support: \d, \p{L}, lookbehind, named groups. Use $1, $<name> and $& in the replacement to reorder or reuse what was matched.
Match preview
See what each rule matches, where, and what it becomes. Line breaks and tabs inside matches are shown as ⏎ and ⇥.
Several rules in one pass
Up to 20 rules run one after another on the result of the previous one – a small clean-up script without code.
Safe with slow patterns
Matching runs in a Web Worker that is stopped after 3 seconds. A pattern with catastrophic backtracking such as (a+)+$ cannot freeze the page; you get a message instead.
Whole words and preserved case
Whole-word matching works for all scripts, not only Latin letters. Preserve case turns "apple" → "pear" into "Apple" → "Pear" and "APPLE" → "PEAR".
Limits & privacy
Text and files can be up to 100 MB. Every run happens in a background worker: for typed text it is stopped after 3 seconds, for files above 8 MB it shows progress and can be cancelled. The preview lists the first 500 matches of the first rule.
A pattern is applied to the whole text, so with the s flag a match may span lines. Patterns are JavaScript regular expressions with the u flag; PCRE-only features such as possessive quantifiers and recursion are not available.
Your text never leaves your browser. See the privacy page.
FAQ
How do I use capture groups in the replacement?
Turn on Regular expression and wrap parts of the pattern in parentheses. $1 inserts the first group, $2 the second, $<name> a named group and $& the whole match.
How do I replace line breaks?
Find \n with Regular expression on, or type \n in the replacement to insert a line break. Windows files use \r\n.
Why does my regex show an error?
The pattern is not valid JavaScript syntax, for example an unclosed bracket. Patterns use the u flag, which is stricter: escape characters like - only inside [ ].
What happens if a regex takes too long?
The worker running it is stopped after 3 seconds and the result is not changed. Make the pattern more specific, for example replace .* with [^,]*.
Can I delete every match?
Yes, leave Replace with empty. Every match is removed.
Is the text sent to a server?
No. Matching and replacing run in your browser; nothing is uploaded.