Sed Command Generator
Builds sed commands for substitution, deletion, printing, and inserts, with a live preview.
Test a regular expression against your own text. Matches are highlighted as you type, with every capture group, its position, and a live replace preview.
| # | Match | Start | End | Groups |
|---|
The tester uses the JavaScript regular expression engine built into your browser, the same one used by String.prototype.matchAll and replace.
g flag every match is listed. Without it, only the first match is.a*, are counted but not highlighted.$1 inserts group 1, $<year> inserts a named group, $& inserts the whole match, and $$ inserts a dollar sign.(\d{4})-(\d{2})-(\d{2}) with flag g on Released 2026-09-26, patched 2026-10-02 finds 2 matches. The first is 2026-09-26 at index 9 to 19, with groups 2026, 09, and 26.$3/$2/$1 gives Released 26/09/2026, patched 02/10/2026.^\s+|\s+$ with flag g matches leading and trailing spaces, the same thing trim() removes.(?<user>[\w.]+)@(?<domain>[\w.-]+) on [email protected] gives the named groups user = ada and domain = example.com.| Flag | Name | Effect |
|---|---|---|
g | Global | Find every match, not just the first |
i | Ignore case | a also matches A |
m | Multiline | ^ and $ match at each line break |
s | Dot all | . also matches line breaks |
u | Unicode | Treats emoji and other astral characters as one character and enables \p{...} |
y | Sticky | Each match must start exactly where the last one ended |
a++), atomic groups, recursion, and \A or \Z are not supported. Lookbehind works in all current browsers.replace would return.JavaScript (ECMAScript), as implemented by your browser. Most everyday syntax is shared with PHP, Python, and Java, but some advanced features differ.
Tick the g (global) flag. Without it, a regular expression stops after the first match.
Escape it with a backslash: \., \(, \[. Without the backslash, a dot matches any character.
No. Type the pattern without the surrounding /.../, and slashes inside it need no escaping.
No. Matching runs in your browser, and nothing you type is sent anywhere.
Often used together with the Regex Tester.
Builds sed commands for substitution, deletion, printing, and inserts, with a live preview.
Compares two texts or code files and highlights added, removed, and changed lines.
Percent-encodes and decodes text for URLs.