mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 14:30:10 +01:00
feat: allow regex in conditions
This commit is contained in:
parent
3d80ecf9b8
commit
b5c19f9a36
4 changed files with 28 additions and 12 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue