Function human_regex::xor

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

Xor on two bracketed expressions, also known as symmetric difference.

If you would like to use ranges, collect them into a Vec.

use human_regex::xor;
let regex_string = xor(&('a'..='g').collect::<Vec<char>>(), &('b'..='h').collect::<Vec<char>>());
println!("{}", regex_string);
assert!(regex_string.to_regex().is_match("a"));
assert!(regex_string.to_regex().is_match("h"));
assert!(!regex_string.to_regex().is_match("d"));