Why is word match not working? #2775
-
Isn't the behavior supposed to be the same as grep here? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This has nothing to do with the
In this case, Apparently POSIX says that the regex
In the general case, no, it isn't: https://github.com/BurntSushi/ripgrep/blob/master/FAQ.md#posix4ever |
Beta Was this translation helpful? Give feedback.
This has nothing to do with the
--w/--word-regexp
flag. This is due to the fact that grep uses basic regular expressions (BREs) by default. BREs have different escaping rules and different rules around when*
is "special" or not. In this case, since it appears the beginning of the regex, it isn't "special" and matched literally. If you use extended regular expressions (EREs) instead, then the*
is treated specially: