In Rust regex, is there a similar function to filtered_re.h in RE2 #923
Answered
by
BurntSushi
yangwentong
asked this question in
Q&A
-
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.
Answered by
BurntSushi
Nov 2, 2022
Replies: 1 comment 1 reply
-
No. You can use the |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
yangwentong
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.