pub struct PyRegexMatch { /* private fields */ }
Expand description
A wrapper for the match object from the Python regex
module.
Implementations§
Source§impl PyRegexMatch
impl PyRegexMatch
Sourcepub fn group(&self, group: u16) -> PyResult<Option<String>>
pub fn group(&self, group: u16) -> PyResult<Option<String>>
Returns the match for the specified group.
For example, group(0)
is the entire match, group(1)
is the first subgroup, etc.
Sourcepub fn groups(&self) -> PyResult<Vec<Option<String>>>
pub fn groups(&self) -> PyResult<Vec<Option<String>>>
Returns all captured groups as a vector.
Analogous to Python’s groups()
method, which returns a tuple of all subgroups (starting from 1).
Sourcepub fn groupdict(&self) -> PyResult<HashMap<String, Option<String>>>
pub fn groupdict(&self) -> PyResult<HashMap<String, Option<String>>>
Returns the named groups dictionary (groupdict()
) as a HashMap
.
Auto Trait Implementations§
impl Freeze for PyRegexMatch
impl !RefUnwindSafe for PyRegexMatch
impl Send for PyRegexMatch
impl Sync for PyRegexMatch
impl Unpin for PyRegexMatch
impl UnwindSafe for PyRegexMatch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more