Skip to main content

RegexBuilder

Struct RegexBuilder 

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

A builder for a Regex with readable options — the mirror of regex::RegexBuilder.

Implementations§

Source§

impl RegexBuilder

Source

pub fn new(pattern: &str) -> RegexBuilder

Start building from pattern.

Source

pub fn case_insensitive(&mut self, yes: bool) -> &mut RegexBuilder

Case-insensitive matching (ASCII; REAL’s icase). Maps to (?i).

Source

pub fn multi_line(&mut self, yes: bool) -> &mut RegexBuilder

^/$ match at line boundaries. Maps to (?m).

Source

pub fn dot_matches_new_line(&mut self, yes: bool) -> &mut RegexBuilder

. matches newlines. Maps to (?s).

Source

pub fn ignore_whitespace(&mut self, yes: bool) -> &mut RegexBuilder

Verbose mode — insignificant whitespace and # comments. Maps to (?x).

Source

pub fn unicode(&mut self, yes: bool) -> &mut RegexBuilder

Unicode mode. true (the default) keeps REAL’s Unicode str semantics; false restricts \w \d \s \b and case folding to ASCII (REAL’s ascii flag), mirroring regex’s unicode(false).

Source

pub fn size_limit(&mut self, _bytes: usize) -> &mut RegexBuilder

Accepted for API compatibility with regex; REAL enforces its own fixed complexity caps, so this is a no-op (there is no per-pattern memory budget to set).

Source

pub fn build(&self) -> Result<Regex, Error>

Compile the configured pattern.

Auto Trait Implementations§

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 = !

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.