Skip to content

does ripgrep's regex engine follow a specification? and is it compatible with .NET's regex engine? #2602

Answered by BurntSushi
Akash-Mair asked this question in Q&A
Discussion options

You must be logged in to vote

It is not. AFAIK, .NET does not follow any spec. And ripgrep uses Rust's regex crate, and that doesn't follow any spec either. In general, there are only two broadly applicable regex specifications: POSIX and ECMAScript. AFAIK, .NET allows you to opt into ECMAScript if you wanted to. But both specifications require implementing features that are not known how to implement efficiently (such as look-around). In contrast, Rust's regex crate follows the RE2 tradition and specific eschews those features so that it can use finite automata as an implementation technique and guarantee worst case linear time searches.

Rust's regex crate syntax is documented here: https://docs.rs/regex/latest/regex…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Akash-Mair
Comment options

@ltrzesniewski
Comment options

@BurntSushi
Comment options

Answer selected by BurntSushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants