Returns the capture groups corresponding to the leftmost-first match in `text`. Capture group `0` always corresponds to the entire match. If no match is found, then `None` is returned. You should only use `captures` if you need access to the location of capturing group matches. Otherwise, `find` is faster for discovering the location of the overall match. # Examples Say you have some text with
(&self, text: &'t [u8])
| 252 | /// The `0`th capture group is always unnamed, so it must always be |
| 253 | /// accessed with `get(0)` or `[0]`. |
| 254 | pub fn captures<'t>(&self, text: &'t [u8]) -> Option<Captures<'t>> { |
| 255 | let mut locs = self.capture_locations(); |
| 256 | self.captures_read_at(&mut locs, text, 0).map(move |_| Captures { |
| 257 | text: text, |
| 258 | locs: locs.0, |
| 259 | named_groups: self.0.capture_name_idx().clone(), |
| 260 | }) |
| 261 | } |
| 262 | |
| 263 | /// Returns an iterator over all the non-overlapping capture groups matched |
| 264 | /// in `text`. This is operationally the same as `find_iter`, except it |