Skip to main content

Regex

Struct Regex 

Source
pub struct Regex { /* private fields */ }
Expand description

compiled regex backed by a lazy DFA.

uses a Mutex for mutable DFA state; clone for per-thread matching.

Implementations§

Source§

impl Regex

Source

pub fn new(pattern: &str) -> Result<Regex, Error>

compile with default options.

Source

pub fn with_options(pattern: &str, opts: EngineOptions) -> Result<Regex, Error>

compile with custom options.

Source

pub fn from_node( b: RegexBuilder, node: NodeId, opts: EngineOptions, ) -> Result<Regex, Error>

build from a pre-constructed AST node.

Source

pub fn dfa_stats(&self) -> (usize, usize)

(fwd_states, rev_states) count.

Source

pub fn find_all(&self, input: &[u8]) -> Result<Vec<Match>, Error>

all non-overlapping matches, left-to-right.

Source

pub fn effects_debug(&self) -> String

debug: dump rev DFA effects_id and effects.

Source

pub fn collect_rev_nulls_debug(&self, input: &[u8]) -> Vec<usize>

debug: run only the reverse DFA, return null positions.

Source

pub fn find_anchored(&self, input: &[u8]) -> Result<Option<Match>, Error>

longest match anchored at position 0, forward DFA only.

Source

pub fn is_match(&self, input: &[u8]) -> Result<bool, Error>

whether the pattern matches anywhere in the input.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.