blog

12021-08-28

SEAN K.H. LIAO

cli tools

The unix way: lots of tiny tools. Unfortunately this also means the same thing is implemented many times, with differing results. Like regex

regex

Thankfully these mostly fall into 2 groups:

both sed and grep take -E to switch to extended mode

            sed     vim        grep    awk        ripgrep    sd
grouping    \(\|\)  \(\|\)     \(\|\)  (|)        (|)        (|)
list        []      []         []      []         []         []
classes     [[:c:]] [[:c:]] \w [[:c:]] [[:c:]] \w [[:c:]] \w [[:c:]] \w
0+          *       *          *       *          *          *
0+ ungreedy                                       *?         *?
1+          \+      \+         \+      +          +          +
0,1         \?      \?         \?      ?          ?          ?
count       \{x,y\} \{x,y\}    \{x,y\} {x,y}      {x,y}      {x,y}

other

Here's a gist on a some regex engines, and wikipedia.