pub struct Regex { /* private fields */ }Expand description
A compiled regular expression.
Implementations§
Source§impl Regex
impl Regex
Sourcepub fn capture_names(&self) -> impl Iterator<Item = &str>
pub fn capture_names(&self) -> impl Iterator<Item = &str>
Returns the names of all named capture groups.
Sourcepub fn is_match(&self, text: &str) -> bool
pub fn is_match(&self, text: &str) -> bool
Returns true if the regex matches anywhere in the text.
Sourcepub fn find<'t>(&self, text: &'t str) -> Option<Match<'t>>
pub fn find<'t>(&self, text: &'t str) -> Option<Match<'t>>
Returns the first match in the text.
Sourcepub fn find_iter<'a>(&'a self, text: &'a str) -> Matches<'a> ⓘ
pub fn find_iter<'a>(&'a self, text: &'a str) -> Matches<'a> ⓘ
Returns an iterator over all non-overlapping matches.
Sourcepub fn captures<'t>(&self, text: &'t str) -> Option<Captures<'t>>
pub fn captures<'t>(&self, text: &'t str) -> Option<Captures<'t>>
Returns the capture groups for the first match.
Sourcepub fn captures_iter<'r, 't>(&'r self, text: &'t str) -> CapturesIter<'r, 't> ⓘ
pub fn captures_iter<'r, 't>(&'r self, text: &'t str) -> CapturesIter<'r, 't> ⓘ
Returns an iterator over all non-overlapping captures.
Sourcepub fn replace<'t>(&self, text: &'t str, rep: &str) -> Cow<'t, str>
pub fn replace<'t>(&self, text: &'t str, rep: &str) -> Cow<'t, str>
Replaces the first match with the replacement string.
Sourcepub fn engine_name(&self) -> &'static str
pub fn engine_name(&self) -> &'static str
Returns the name of the engine being used (for debugging).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Regex
impl RefUnwindSafe for Regex
impl Send for Regex
impl Sync for Regex
impl Unpin for Regex
impl UnwindSafe for Regex
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