regex_automata::util::syntax

Function parse_many

source
pub fn parse_many<P: AsRef<str>>(patterns: &[P]) -> Result<Vec<Hir>, Error>
Expand description

A convenience routine for parsing many patterns into HIR value with the default configuration.

ยงExample

This shows how to parse many patterns into an corresponding HIR values:

use {
    regex_automata::util::syntax,
    regex_syntax::hir::Properties,
};

let hirs = syntax::parse_many(&[
    r"([a-z]+)|([0-9]+)",
    r"foo(A-Z]+)bar",
])?;
let props = Properties::union(hirs.iter().map(|h| h.properties()));
assert_eq!(Some(1), props.static_explicit_captures_len());