does ripgrep's regex engine follow a specification? and is it compatible with .NET's regex engine? #2602
-
Hey regex noob here, Im using both ripgrep and the Thank you :D |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
It is not. AFAIK, .NET does not follow any spec. And ripgrep uses Rust's Rust's regex crate syntax is documented here: https://docs.rs/regex/latest/regex/#syntax You can also browse through the Overall, if you stick to "simple" regexes, then they should generally behave the same. But there are likely a number of corner cases where behavior differs. And of course, .NET supports more stuff that Rust's regex crate. If you need to deal with that, then you can opt into using PCRE2 in ripgrep with the |
Beta Was this translation helpful? Give feedback.
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…