feat: allow regex in conditions

This commit is contained in:
iff 2025-04-09 17:16:58 +02:00
parent 3d80ecf9b8
commit b5c19f9a36
4 changed files with 28 additions and 12 deletions

View file

@ -18,6 +18,11 @@ fn regex_captures(regex: &str, string: &str) -> Vec<String> {
caps
}
pub fn regex_match(regex: &str, string: &str) -> bool {
let regex = Regex::new(regex).unwrap();
regex.is_match(string)
}
pub fn opt_regex(regex: &str, command: &mut String) -> String {
let opts = regex_captures(regex, command);