About Regex Replace
Regex replace finds text by a pattern, not just by exact words, and replaces it. Paste your text, write a JavaScript regular expression in Find and a replacement in Replace with, and use $1, $2 or $<name> to reuse the parts you captured. It is free, needs no sign-up and runs in your browser, so nothing you enter is uploaded.
This page starts with Regex ticked. Two extra options appear for regular expressions: Multiline makes ^ and $ match at the start and end of each line, and Dot matches newline lets the dot cross line breaks. If the pattern is not valid, the rule says "Invalid regular expression." and changes nothing.
Matching ignores case until you tick Case sensitive, and Replace all is on until you untick it. The count under each rule tells you how many matches it made, which is the quickest way to check that your pattern did what you meant.
How to use Regex Replace
- Paste your text into the Text box.
- Type the text to look for in Find and its replacement in Replace with. The Result below shows the new text and says how many replacements were made.
- Tick Case sensitive, Whole word, or Regex as needed. Untick Replace all to change only the first match.
- Press Add rule to run several replacements in order. Each rule works on the output of the one before it.
- Tick Remove line breaks, Remove extra spaces or Remove duplicate lines for a cleanup. Then Copy, Download .txt, or Move to input to work on the result.
Features
- Plain text or regular expression (JavaScript syntax) rules.
- Case sensitive and Whole word options, and Replace all or first match only.
- Regex options for multiline (^ and $ match at each line) and dot matches newline.
- Capture groups in the replacement: $1, $2, $&, $$ and named $<name>.
- Several rules in one pass, applied in order, with a replacement count for each.
- Cleanups for line breaks, extra spaces and duplicate lines.
- A clear message when a regular expression is invalid, instead of a crash.
- Move to input, Undo, Copy and Download .txt.
Worked examples
Find (\w+)@(\w+)\.com, replace $2: $1, in: [email protected], [email protected] gives acme: ann, zeta: bob (2 replaced)
Find (\d{4})-(\d{2})-(\d{2}), replace $3/$2/$1, in: 2026-10-26 and 2025-01-02 gives 26/10/2026 and 02/01/2025 (2 replaced)
Dates reordered from year-month-day to day-month-year.
Find (?<y>\d{4})-(?<m>\d{2}), replace $<m>/$<y>, in: 2026-10-26 gives 10/2026-26 (1 replaced)
Named groups with $<name>. The pattern matched only the year and month, so the day stays.
Find [ \t]+$ with Multiline on, in: "a ", "b ", "c" on three lines gives a, b, c on three lines (2 replaced)
Trailing spaces removed from every line.
A few useful patterns
| Find | Replace with | Does |
|---|---|---|
| [ \t]+$ (Multiline) | (empty) | Removes trailing spaces on every line |
| ^\s*\n (Multiline) | (empty) | Removes blank lines |
| ,\s* | , | Puts exactly one space after every comma |
| (\d{4})-(\d{2})-(\d{2}) | $3/$2/$1 | Reorders a date |
Privacy: how it works
- The replacing runs in your browser tab. Your text is not sent to Ulkaa or to any other server.
- This tool does not save your text. Close or reload the page and it is gone.
Tips
- Turn on Whole word when you replace short words, or "cat" will also change "category".
- Test a regex on a small piece of text before you run it on a long one. The count tells you whether it matched what you expected.
- Use Move to input to continue from the result, and Undo if a step went wrong.
- Keep a copy of the original text. This tool does not save it for you.
Frequently asked questions
Is it really free?
Yes. There is no price, no trial and no credit card. Ulkaa Tool does the work with your own device, so there is no server bill to pass on to you.
Do I need an account?
No. There is no sign-up and no login. Open the page and use it. An Ulkaa account is not needed for anything on this tool.
Does it run in my browser?
Yes. Your text are processed by code running in your browser tab, on your own device.
Is my data uploaded?
No. Your text are never sent to Ulkaa or to anyone else. You can check this yourself by watching the Network tab in your browser developer tools while you use the tool.
Which regex syntax does it use?
JavaScript regular expressions, the same as your browser. Lookbehind and named groups work. Features from other engines may not.
How do I reuse part of the match in the replacement?
Put the part in parentheses in Find to make a group, and write $1 for the first group, $2 for the second, and so on. $& is the whole match.
Why does it say Invalid regular expression?
The pattern is not valid, usually because of an unclosed bracket or parenthesis, or a symbol that needs a backslash. Fix the pattern and the rule runs again.
More Find and Replace Text pages
- Find and Replace TextPaste your text, set one or more rules and see the replaced result with a count.
- Find and ReplaceReplace every copy of a word or phrase in your text at once.
- Remove Line BreaksJoin your text into one line by removing every line break.
- Remove Extra SpacesCollapse double spaces and trim every line.
- Remove Duplicate LinesKeep the first copy of each line and drop the repeats.
- Replace Multiple Words at OnceRun several find and replace rules on your text in one go.