search start/end of word with ripgrep

ripgrep doesn’t support the \< and \> word boundaries, which specifically only match the start and end of a word, respectively. ripgrep does however support \b, which matches a word boundary anywhere. In this case, it’s good enough for your specific example:

$ echo 'play allegro here' | rg '\bleg\b'
$ echo 'I have a leg.' | rg '\bleg\b'
I have a leg.    

ripgrep also supports grep’s -w flag, which effectively does the same thing in this case:

$ echo 'play allegro here' | rg -w leg
$ echo 'I have a leg.' | rg -w leg
I have a leg.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)