regex_automata::util::syntax

Function parse_with

Source
pub fn parse_with(pattern: &str, config: &Config) -> Result<Hir, Error>
Expand description

A convenience routine for parsing a pattern into an HIR value using a Config.

ยงExample

This shows how to parse a pattern into an HIR value with a non-default configuration:

use regex_automata::util::syntax;

let hir = syntax::parse_with(
    r"^[a-z]+$",
    &syntax::Config::new().multi_line(true).crlf(true),
)?;
assert!(hir.properties().look_set().contains_anchor_crlf());