Function human_regex::subtract

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

Subtracts the second argument from the first

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

use human_regex::subtract;
let regex_string = subtract(&('0'..='9').collect::<Vec<char>>(), &['4']);
println!("{}", regex_string);
assert!(regex_string.to_regex().is_match("3"));
assert!(regex_string.to_regex().is_match("9"));
assert!(!regex_string.to_regex().is_match("4"));