[−][src]Struct onig::Captures
Captures represents a group of captured strings for a single match.
The 0th capture always corresponds to the entire match. Each subsequent index corresponds to the next capture group in the regex. Positions returned from a capture group are always byte indices.
't
is the lifetime of the matched text.
Methods
impl<'t> Captures<'t>
[src]
pub fn pos(&self, pos: usize) -> Option<(usize, usize)>
[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.
pub fn at(&self, pos: usize) -> Option<&'t str>
[src]
Returns the matched string for the capture group i
. If i
isn't
a valid capture group or didn't match anything, then None
is returned.
pub fn len(&self) -> usize
[src]
Returns the number of captured groups.
pub fn is_empty(&self) -> bool
[src]
Returns true if and only if there are no captured groups.
ⓘImportant traits for SubCaptures<'t>pub fn iter(&'t self) -> SubCaptures<'t>
[src]
Creates an iterator of all the capture groups in order of appearance in the regular expression.
ⓘImportant traits for SubCapturesPos<'t>pub fn iter_pos(&'t self) -> SubCapturesPos<'t>
[src]
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 offset(&self) -> usize
[src]
Offset of the captures within the given string slice.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,