Skip to main content

check_regex

Function check_regex 

Source
pub fn check_regex(pattern: &str) -> Result<(), String>
Expand description

Check that a |re value is a valid regular expression.

Lookaround and backreferences are accepted, as in pySigma and the PCRE dialect that Sigma regular expressions follow, although the evaluator rejects them when it compiles the rule.

ยงExamples

use rsigma_parser::validate::check_regex;

assert!(check_regex(r"^cmd\.exe$").is_ok());
assert!(check_regex(r"(?<!\\)cmd").is_ok());
assert!(check_regex("a(b").is_err());