[−][src]Struct regex_syntax::ExprBuilder
A builder for configuring regular expression parsing.
This allows setting the default values of flags and other options, such as the maximum nesting depth.
Methods
impl ExprBuilder
[src]
pub fn new() -> ExprBuilder
[src]
Create a new builder for configuring expression parsing.
Note that all flags are disabled by default.
pub fn case_insensitive(self, yes: bool) -> ExprBuilder
[src]
Set the default value for the case insensitive (i
) flag.
pub fn multi_line(self, yes: bool) -> ExprBuilder
[src]
Set the default value for the multi-line matching (m
) flag.
pub fn dot_matches_new_line(self, yes: bool) -> ExprBuilder
[src]
Set the default value for the any character (s
) flag.
pub fn swap_greed(self, yes: bool) -> ExprBuilder
[src]
Set the default value for the greedy swap (U
) flag.
pub fn ignore_whitespace(self, yes: bool) -> ExprBuilder
[src]
Set the default value for the ignore whitespace (x
) flag.
pub fn unicode(self, yes: bool) -> ExprBuilder
[src]
Set the default value for the Unicode (u
) flag.
If yes
is false, then allow_bytes
is set to true.
pub fn allow_bytes(self, yes: bool) -> ExprBuilder
[src]
Whether the parser allows matching arbitrary bytes or not.
When the u
flag is disabled (either with this builder or in the
expression itself), the parser switches to interpreting the expression
as matching arbitrary bytes instead of Unicode codepoints. For example,
the expression (?u:\xFF)
matches the codepoint \xFF
, which
corresponds to the UTF-8 byte sequence \xCE\xBF
. Conversely,
(?-u:\xFF)
matches the byte \xFF
, which is not valid UTF-8.
When allow_bytes
is disabled (the default), an expression like
(?-u:\xFF)
will cause the parser to return an error, since it would
otherwise match invalid UTF-8. When enabled, it will be allowed.
pub fn nest_limit(self, limit: usize) -> ExprBuilder
[src]
Set the nesting limit for regular expression parsing.
Regular expressions that nest more than this limit will result in a
StackExhausted
error.
pub fn parse(self, s: &str) -> Result<Expr>
[src]
Parse a string as a regular expression using the current configuraiton.
Trait Implementations
impl Clone for ExprBuilder
[src]
fn clone(&self) -> ExprBuilder
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ExprBuilder
[src]
Auto Trait Implementations
impl Send for ExprBuilder
impl Sync for ExprBuilder
impl Unpin for ExprBuilder
impl UnwindSafe for ExprBuilder
impl RefUnwindSafe for ExprBuilder
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,