pub fn regex_with(pattern: &str, opts: &PatternOpts) -> Result<Pattern, PatternError> {
        let pattern = pattern.trim_start_matches('^');
        let pattern = pattern.trim_end_matches('$');
        let pattern = pattern.to_string();

        let anchored_regex = "^".to_string() + &pattern + "$";
        let anchored_regex = Regex::new(anchored_regex.as_str(), opts.case_insensitive);
        let prefix_regex = "^".to_string() + &pattern;
        let prefix_regex = Regex::new(prefix_regex.as_str(), opts.case_insensitive);

        match anchored_regex {
            Ok(anchored_regex) => Ok(Pattern {
                src: pattern,
                anchored_regex,
                prefix_regex: prefix_regex.unwrap(),
            }),
            Err(e) => Err(PatternError {
                input: pattern,
                cause: e.to_string(),
            }),
        }
    }
/// Creates `Pattern` instance from raw regular expression. Supports PCRE syntax.
/// Allows to specify case sensitivity
Creates `Pattern` instance from raw regular expression. Supports PCRE syntax.
Allows to specify case sensitivity
Creates ` Pattern ` instance from raw regular expression . Supports PCRE syntax . Allows to specify case sensitivity
pub fn regex_with(pattern: &str, opts: &PatternOpts) -> Result<Pattern, PatternError> {
        let pattern = pattern.trim_start_matches('^');
        let pattern = pattern.trim_end_matches('$');
        let pattern = pattern.to_string();
        let anchored_regex = "^".to_string() + &pattern + "$";
        let anchored_regex = Regex::new(anchored_regex.as_str(), opts.case_insensitive);
        let prefix_regex = "^".to_string() + &pattern;
        let prefix_regex = Regex::new(prefix_regex.as_str(), opts.case_insensitive);
        match anchored_regex {
            Ok(anchored_regex) => Ok(Pattern {
                src: pattern,
                anchored_regex,
                prefix_regex: prefix_regex.unwrap(),
            }),
            Err(e) => Err(PatternError {
                input: pattern,
                cause: e.to_string(),
            }),
        }
    }
pub fn regex_with ( pattern : & str , opts : & PatternOpts ) -> Result < Pattern , PatternError > { let pattern = pattern . trim_start_matches ( '^' ) ; let pattern = pattern . trim_end_matches ( '$' ) ; let pattern = pattern . to_string ( ) ; let anchored_regex = " " . to_string ( ) + & pattern + " " ; let anchored_regex = Regex :: new ( anchored_regex . as_str ( ) , opts . case_insensitive ) ; let prefix_regex = " " . to_string ( ) + & pattern ; let prefix_regex = Regex :: new ( prefix_regex . as_str ( ) , opts . case_insensitive ) ; match anchored_regex { Ok ( anchored_regex ) => Ok ( Pattern { src : pattern , anchored_regex , prefix_regex : prefix_regex . unwrap ( ) , } ) , Err ( e ) => Err ( PatternError { input : pattern , cause : e . to_string ( ) , } ) , } }
Creates `Pattern` instance from raw regular expression.
Creates ` Pattern ` instance from raw regular expression .
pattern
&str
opts
&PatternOpts
pattern
&str
opts
&PatternOpts