Hacker News new | ask | show | jobs
by oguz-ismail 584 days ago
It's not compatible with grep though. How do you search for a square bracket?

    $ grep '[][]' </dev/null
    $ rg '[][]' </dev/null
    rg: regex parse error:
        (?:[][])
             ^^
    error: unclosed character class
    $
And why does it search the current directory when its input is redirected from /dev/null? What other surprises are there?
3 comments

To me, ripgrep is an improvement and the differences are a good thing.
It's compatible or close enough with more modern regex syntaxes. Which are probably familiar to a lot more people than grep. Want to search for square brackets, then escape them (or do a a string literal search with -F)