Struct regex_syntax::ExprBuilder
[−]
[src]
pub struct ExprBuilder { /* fields omitted */ }
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]
impl ExprBuilder
pub fn new() -> ExprBuilder
[src]
pub fn new() -> ExprBuilder
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]
pub fn case_insensitive(self, yes: bool) -> ExprBuilder
Set the default value for the case insensitive (i
) flag.
pub fn multi_line(self, yes: bool) -> ExprBuilder
[src]
pub fn multi_line(self, yes: bool) -> ExprBuilder
Set the default value for the multi-line matching (m
) flag.
pub fn dot_matches_new_line(self, yes: bool) -> ExprBuilder
[src]
pub fn dot_matches_new_line(self, yes: bool) -> ExprBuilder
Set the default value for the any character (s
) flag.
pub fn swap_greed(self, yes: bool) -> ExprBuilder
[src]
pub fn swap_greed(self, yes: bool) -> ExprBuilder
Set the default value for the greedy swap (U
) flag.
pub fn ignore_whitespace(self, yes: bool) -> ExprBuilder
[src]
pub fn ignore_whitespace(self, yes: bool) -> ExprBuilder
Set the default value for the ignore whitespace (x
) flag.
pub fn unicode(self, yes: bool) -> ExprBuilder
[src]
pub fn unicode(self, yes: bool) -> ExprBuilder
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]
pub fn allow_bytes(self, yes: bool) -> ExprBuilder
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]
pub fn nest_limit(self, limit: usize) -> ExprBuilder
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]
pub fn parse(self, s: &str) -> Result<Expr>
Parse a string as a regular expression using the current configuraiton.
Trait Implementations
impl Clone for ExprBuilder
[src]
impl Clone for ExprBuilder
fn clone(&self) -> ExprBuilder
[src]
fn clone(&self) -> ExprBuilder
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for ExprBuilder
[src]
impl Debug for ExprBuilder
Auto Trait Implementations
impl Send for ExprBuilder
impl Send for ExprBuilder
impl Sync for ExprBuilder
impl Sync for ExprBuilder