1 // Copyright 2010 The RE2 Authors. All Rights Reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
16 // An RE2::Set represents a collection of regexps that can
17 // be searched for simultaneously.
20 Set(const RE2::Options& options, RE2::Anchor anchor);
23 // Add adds regexp pattern to the set, interpreted using the RE2 options.
24 // (The RE2 constructor's default options parameter is RE2::UTF8.)
25 // Add returns the regexp index that will be used to identify
26 // it in the result of Match, or -1 if the regexp cannot be parsed.
27 // Indices are assigned in sequential order starting from 0.
28 // Error returns do not increment the index.
29 // If an error occurs and error != NULL, *error will hold an error message.
30 int Add(const StringPiece& pattern, string* error);
32 // Compile prepares the Set for matching.
33 // Add must not be called again after Compile.
34 // Compile must be called before FullMatch or PartialMatch.
35 // Compile may return false if it runs out of memory.
38 // Match returns true if text matches any of the regexps in the set.
39 // If so, it fills v with the indices of the matching regexps.
40 bool Match(const StringPiece& text, vector<int>* v) const;
43 RE2::Options options_;
45 vector<re2::Regexp*> re_;
48 //DISALLOW_EVIL_CONSTRUCTORS(Set);
50 void operator=(const Set&);