Lines Matching refs:set

17 /// A regex set corresponds to the union of two or more regular expressions.
18 /// That is, a regex set will match text where at least one of its
19 /// constituent regular expressions matches. A regex set as its formulated here
21 /// expressions in the set match. Indeed, this is the key difference between
27 /// regex set is constructed from those regexes, then searching the text
30 /// searches over the text. The key advantage of using a regex set is that it
34 /// set can realize huge performance gains.
59 /// 1. Does any regex in the set match?
60 /// 2. If so, which regexes in the set match?
67 /// [`Captures`][crate::Captures] objects from a regex set. If you need these
68 /// operations, the recommended approach is to compile each pattern in the set
79 /// // Compile a set matching any of our patterns.
80 /// let set = RegexSet::new(&patterns).unwrap();
82 /// let regexes: Vec<_> = set.patterns().iter()
86 /// // Match against the whole set first and identify the individual
88 /// let matches: Vec<&str> = set.matches(text).into_iter()
106 /// regex set and `n` is proportional to the length of the search text.
111 /// Create a new regex set with the given regular expressions.
119 /// Create a new regex set from an iterator of strings:
123 /// let set = RegexSet::new(&[r"\w+", r"\d+"]).unwrap();
124 /// assert!(set.is_match("foo"));
131 /// Create a new empty regex set.
137 /// let set = RegexSet::empty();
138 /// assert!(set.is_empty());
144 /// Returns true if and only if one of the regexes in this set matches
148 /// of the regexes in the set should match, but don't care about *which*
160 /// Tests whether a set matches some text:
164 /// let set = RegexSet::new(&[r"\w+", r"\d+"]).unwrap();
165 /// assert!(set.is_match("foo"));
166 /// assert!(!set.is_match("☃"));
183 /// Returns the set of regular expressions that match in the given text.
185 /// The set returned contains the index of each regular expression that
189 /// The set can also be used to iterate over the matched indices.
202 /// let set = RegexSet::new(&[
211 /// let matches: Vec<_> = set.matches("foobar").into_iter().collect();
215 /// let matches = set.matches("foobar");
236 /// in this set.
239 /// `matches` is true after executing the set against `text`.
250 /// Returns the total number of regular expressions in this set.
255 /// Returns `true` if this set contains no regular expressions.
260 /// Returns the patterns that this set will match on.
263 /// slice returned has exactly as many patterns givens to this regex set,
265 /// provided to the set.
271 /// let set = RegexSet::new(&[
280 /// let matches: Vec<_> = set
283 /// .map(|match_idx| &set.patterns()[match_idx])
292 /// A set of matches returned by a regex set.
300 /// Whether this set contains any matches.
317 /// The total number of regexes in the set that created these matches.
326 /// respect to its position when initially building the set.
350 /// An owned iterator over the set of matches from a regex set.
354 /// its position when initially building the set.
390 /// A borrowed iterator over the set of matches from a regex set.
396 /// its position when initially building the set.
458 /// let set = RegexSet::new(&[
463 /// // Ask whether any regexes in the set match.
464 /// assert!(set.is_match("foo@example.com"));
466 /// // Identify which regexes in the set match.
467 /// let matches: Vec<_> = set.matches("foo@example.com").into_iter().collect();
471 /// let matches: Vec<_> = set.matches("example.com").into_iter().collect();
474 /// // Try again, but with text that doesn't match any regex in the set.
475 /// let matches: Vec<_> = set.matches("example").into_iter().collect();
487 /// let set = RegexSet::new(&[
492 /// // Ask whether any regexes in the set match.
493 /// assert!(set.is_match(b"foo@example.com"));
495 /// // Identify which regexes in the set match.
496 /// let matches: Vec<_> = set.matches(b"foo@example.com").into_iter().collect();
500 /// let matches: Vec<_> = set.matches(b"example.com").into_iter().collect();
503 /// // Try again, but with text that doesn't match any regex in the set.
504 /// let matches: Vec<_> = set.matches(b"example").into_iter().collect();