pub struct Regex { /* private fields */ }Expand description
A compiled PHP regular expression (delimiters and modifiers included):
a pcre_cache_entry.
Implementations§
Source§impl Regex
impl Regex
Sourcepub fn compiled(regex: &[u8]) -> Result<Arc<Regex>, CompileFailure>
pub fn compiled(regex: &[u8]) -> Result<Arc<Regex>, CompileFailure>
pcre_get_compiled_regex_cache() as preg_match() calls it: the
pattern from the per-process cache, compiled (JIT included, as the
process has it) on a miss. A pattern that does not compile is the
warning preg_match() emits for it.
Source§impl Regex
impl Regex
Sourcepub fn new(regex: &[u8]) -> Result<Regex, CompileFailure>
pub fn new(regex: &[u8]) -> Result<Regex, CompileFailure>
Parses the delimiters and modifiers of a PHP regex and compiles it
(pcre_get_compiled_regex_cache()), with JIT code while pcre.jit
is on. Unlike Regex::compiled, it bypasses PHP’s cache, and a
JIT failure leaves the pattern interpreted without a warning.
Sourcepub fn capture_count(&self) -> u32
pub fn capture_count(&self) -> u32
The number of capturing groups.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Regex
impl Freeze for Regex
impl Move 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