Returns the start and end positions of the Nth capture group. Returns `None` if `i` is not a valid capture group or if the capture group did not match anything. The positions returned are *always* byte indices with respect to the original string matched.
(&self, i: usize)
| 27 | /// not match anything. The positions returned are *always* byte indices |
| 28 | /// with respect to the original string matched. |
| 29 | pub fn pos(&self, i: usize) -> Option<(usize, usize)> { |
| 30 | let (s, e) = (i * 2, i * 2 + 1); |
| 31 | match (self.0.get(s), self.0.get(e)) { |
| 32 | (Some(&Some(s)), Some(&Some(e))) => Some((s, e)), |
| 33 | _ => None, |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | /// Creates an iterator of all the capture group positions in order of |
| 38 | /// appearance in the regular expression. Positions are byte indices |