GNU+Linux command memo

Test Regular Expression

Test regular or rational expression, or regex, regexp.

Tester une expression régulière ou rationnelle

$ echo "text" | egrep --color "regex"

If it appears that you don’t have egrep available, try with grep -E.

You can also use rg from the Debian package ripgrep as presented here:

$ echo "text" | rg "regex" (1)
1 to actually get line numbers at the begining of each result line add the -n option