Regex tester
Test a regular expression against your text, see every match and group, and get the matching grep and sed command with flavour notes.
Everything here runs in your browser. Nothing you type is sent to D's Labs or anyone else.
2026-11-16 10:02:11 ERROR db: connection refused (port 5432) 2026-11-16 10:02:14 INFO api: retrying in 3s 2026-11-16 10:02:17 ERROR db: connection refused (port 5432)
#1 at 20: “ERROR db:” — groups: $1=ERROR, $2=db
#2 at 127: “ERROR db:” — groups: $1=ERROR, $2=db
grep -Eo '(ERROR)\s+(\w+):' file.txtsed -E 's/(ERROR)\s+(\w+):/[\2] \1/g' file.txt• \w works in GNU grep and sed, but not in every grep; [[:alnum:]_] is portable.
• \s works in GNU tools; [[:space:]] is portable.
One pattern, three dialects
This page tests with your browser's JavaScript engine. GNU grep -E and sed -E use POSIX extended syntax, which has no \d, no lookaround and no lazy quantifiers; grep -P uses PCRE, which has all three. The notes below say when your pattern will behave differently on the command line, and the commands use -P only when they must.