Struct regex::re_trait::Locations [−][src]
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]
impl Locations
pub fn pos(&self, i: usize) -> Option<(usize, usize)>
[src]
pub fn pos(&self, i: usize) -> Option<(usize, usize)>
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>pub fn iter(&self) -> SubCapturesPosIter
[src]
ⓘImportant traits for SubCapturesPosIter<'c>
pub fn iter(&self) -> SubCapturesPosIter
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.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
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.