Struct regex::re_trait::Locations[][src]

pub struct Locations(Vec<Option<usize>>);

Locations represents the offsets of each capturing group in a regex for a single match.

Unlike Captures, a Locations value only stores offsets.

Methods

impl Locations
[src]

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.

Important traits for SubCapturesPosIter<'c>

Creates an iterator of all the capture group positions in order of appearance in the regular expression. Positions are byte indices in terms of the original string matched.

Returns the total number of capturing groups.

This is always at least 1 since every regex has at least 1 capturing group that corresponds to the entire match.