In Rust regex, is there a similar function to filtered_re.h in RE2 #923
-
In RE2, filtered_re.h provides a prefilter mechanism that helps in cutting down the number of regexps that need to be actually searched. // filtered_re.h
// Prepares the regexps added by Add for filtering. Returns a set
// of strings that the caller should check for in candidate texts.
// The returned strings are lowercased and distinct. When doing
// string matching, it should be performed in a case-insensitive
// way or the search text should be lowercased first. Call after
// all Add calls are done.
void Compile(std::vector<std::string>* strings_to_match); I would like to ask if there is a function similar to |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
No. You can use the |
Beta Was this translation helpful? Give feedback.
-
If anyone swings by and is still interested, I've given the port a shot: https://crates.io/crates/regex-filtered It seems to work fine so far, though I won't discount having missed something (the underlying model of Unlike |
Beta Was this translation helpful? Give feedback.
No. You can use the
regex-syntax
to look at the HIR and extract substrings yourself though if you want. And theregex
crate does that internally and tries to do at least part of thefiltered_re.h
optimization on its own, automatically.