pub struct RegEx { /* private fields */ }Expand description
RegEx provides methods to construct a regular expression from a pattern string and
perform common operations such as matching and searching within input text.
Internally, it compiles the pattern into an NFA.
Implementations§
Source§impl RegEx
impl RegEx
Sourcepub fn from_pattern(regex: &str) -> Result<Self, Error>
pub fn from_pattern(regex: &str) -> Result<Self, Error>
Parses the given pattern and returns a compiled RegEx.
§Errors
Returns an error if the pattern contains invalid syntax.
§Supported Syntax
.matches any single character|for alternate:a|bmatchesaorb[]for character classes:[abc]matches any character in the set- Use
^at the beginning to negate:[^abc]matches any character excepta,b, orc
Predefined character classes:
\d,\Dfor digits\l,\Lfor lowercase letters\u,\Ufor uppercase letters\s,\Sfor whitespace
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 UnsafeUnpin 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