sed Playground

A live GNU-sed REPL that runs entirely in your browser — a self-contained take on sed.js.org. Type a script, feed it input, and watch stdout update as you go. Includes a diff view and a step-through debugger.

⌘/Ctrl+ run · ⌘/Ctrl+K clear

  
Supported commands & syntax

This playground implements a faithful subset of GNU sed in pure JavaScript — no server, no WASM — verified against real gsed. BRE/ERE are translated to JavaScript regex, so most patterns behave like GNU sed. File/shell commands (r R w W e) are inert here since there is no filesystem.

s/re/repl/flagssubstitute — flags g p i I m M, a number N (Nth match), Ng. Replacement supports &, \1\9, \n \t, and case ops \U \L \u \l \E.
y/abc/xyz/transliterate characters one-for-one.
p P d D n Nprint / print-first-line / delete / delete-first-line / next / append-next.
h H g G xhold-space: copy/append to hold, copy/append back, exchange.
b t T :labelbranch, branch-if-substituted, branch-if-not, define label.
a i cappend / insert / change text (use a\text or a text).
q Q = l z F { }quit / silent-quit / line number / unambiguous list / zap / filename / grouping.
addressesN, $, /re/, \cREc, first~step, ranges a1,a2, a1,+N, a1,~N, 0,/re/, and ! negation.

Separate multiple commands with ; or newlines. Everything runs locally; nothing is uploaded.