Closed scottchiefbaker closed 6 years ago
From the README:
ripgrep uses a regex engine based on finite automata, so if you want fancy regex features such as backreferences or look around, ripgrep won't give them to you. ripgrep does support lots of things though, including, but not limited to: lazy quantification (e.g., a+?), repetitions (e.g., a{2,5}), begin/end assertions (e.g., ^\w+$), word boundaries (e.g., \bfoo\b), and support for Unicode categories (e.g., \p{Sc} to match currency symbols or \p{Lu} to match any uppercase letter). (Fancier regexes will never be supported.)
From the output of rg --help
:
ripgrep's regex engine uses finite automata and guarantees linear time searching. Because of this, features like backreferences and arbitrary lookaround are not supported.
You might consider rg foobar | rg -v '^\s*#'
(or similar) instead.
I was attempting to find all the lines in my code that contain foobar, and were not commented out. The way I've done this with
ack
andag
in the past has been using lookbehinds:Attemping the same regexp in
rg
I get a parse error: