// Copyright 2009 The RE2 Authors. All Rights Reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. #ifndef RE2_FILTERED_RE2_H_ #define RE2_FILTERED_RE2_H_ // The class FilteredRE2 is used as a wrapper to multiple RE2 regexps. // It provides a prefilter mechanism that helps in cutting down the // number of regexps that need to be actually searched. // // By design, it does not include a string matching engine. This is to // allow the user of the class to use their favorite string matching // engine. The overall flow is: Add all the regexps using Add, then // Compile the FilteredRE2. Compile returns strings that need to be // matched. Note that the returned strings are lowercased and distinct. // For applying regexps to a search text, the caller does the string // matching using the returned strings. When doing the string match, // note that the caller has to do that in a case-insensitive way or // on a lowercased version of the search text. Then call FirstMatch // or AllMatches with a vector of indices of strings that were found // in the text to get the actual regexp matches. #include <memory> #include <string> #include <vector> #include "absl/strings/string_view.h" #include "re2/re2.h" namespace re2 { class PrefilterTree; class FilteredRE2 { … }; } // namespace re2 #endif // RE2_FILTERED_RE2_H_