pub fn build_regex_from_pattern(pat: &str) -> Result<String, PatternError>
Expand description
Build an anchored regular expression from lexed pattern tokens.
§Errors
Returns PatternError
when the tokens describe malformed placeholders or
unbalanced braces.
§Examples
ⓘ
let regex = build_regex_from_pattern("Given {item}")
.expect("example ensures fallible call succeeds");
assert_eq!(regex, r"^Given (.+?)$");