Function human_regex::or

source ·
pub fn or<T>(options: &[T]) -> HumanRegexwhere
    T: Into<String> + Display,
Expand description

A function for establishing an OR relationship between two or more possible matches

use human_regex::{text, logical::or};
let regex_string = text("gr") + or(&[text("a"), text("e")]) + text("y");
println!("{}", regex_string.to_string());
assert!(regex_string.to_regex().is_match("grey"));
assert!(regex_string.to_regex().is_match("gray"));
assert!(!regex_string.to_regex().is_match("graey"));