compile_regex_from_pattern

Function compile_regex_from_pattern 

Source
pub fn compile_regex_from_pattern(pat: &str) -> Result<Regex, PatternError>
Expand description

Build and compile a Regex from a step pattern.

§Errors

Returns PatternError if the pattern translation or regex compilation fails.

§Examples

use rstest_bdd_patterns::compile_regex_from_pattern;
let regex = compile_regex_from_pattern("Given {n:u32}").unwrap();
assert!(regex.is_match("Given 42"));