Back to tools

Text-processing playground

Pick a sample text, write a pipeline and see the result at once. What grep’s and sed’s patterns match is highlighted.

The text is the command’s standard input; you can also name the file data.txt. Commands run in this site’s simulator and change nothing.

Inputdata.txt · 14grep’s pattern matches 3 lines
Output3exit status 0
2026-01-15 09:03:44 ERROR user=bob action=payment ip=10.0.0.8 ms=5002 timeout
2026-01-15 09:06:55 ERROR user=dave action=login ip=10.0.0.21 ms=31 bad_password
2026-01-15 09:08:21 ERROR user=carol action=payment ip=10.0.0.9 ms=5003 timeout
Regular expressions at a glance
.
Any one character
*
The previous character 0 or more times (.* is "anything")
^ / $
Start / end of the line: ^# starts with #, ^$ is an empty line
[abc] / [^abc]
One of these characters / none of them
[0-9] / [a-z]
A digit / a lower-case letter
\. \* \$
The symbol itself: escape it
+ ? | ( ) { }
Special in extended expressions (grep -E, sed -E); in basic ones (grep, sed) write \+ \? \| \( \) \{ \}
a+ / a?
a once or more / at most once (extended)
cat|dog
cat or dog (extended)
[0-9]{3}
Exactly three digits (extended)
\b / -w
A word boundary; grep -w matches whole words only

The simulator has the common text commands and options; its sed has addresses, ranges, -n, p, d, the hold space and more (all but writing files with w).