MCPcopy Create free account
hub / github.com/davidblewett/rure-python / captures

Method captures

regex/src/re_bytes.rs:254–261  ·  view source on GitHub ↗

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])

Source from the content-addressed store, hash-verified

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

Callers 8

match_as_strFunction · 0.45
capture_indexFunction · 0.45
capture_index_panic_nameFunction · 0.45
innerFunction · 0.45
capture_miscFunction · 0.45
sub_capture_matchesFunction · 0.45
regression_captures_repFunction · 0.45

Calls 5

mapMethod · 0.80
cloneMethod · 0.80
capture_name_idxMethod · 0.80
capture_locationsMethod · 0.45
captures_read_atMethod · 0.45

Tested by 8

match_as_strFunction · 0.36
capture_indexFunction · 0.36
capture_index_panic_nameFunction · 0.36
innerFunction · 0.36
capture_miscFunction · 0.36
sub_capture_matchesFunction · 0.36
regression_captures_repFunction · 0.36