From 4d6a38f0106d1cd1e4756f63abd5d910479421aa Mon Sep 17 00:00:00 2001 From: Brad Larsen Date: Mon, 9 Dec 2024 11:50:19 -0500 Subject: [PATCH] Use \z instead of $ for anchoring regexes for 2-stage Vectorscan+regex matching --- crates/noseyparker-rules/src/rule.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/noseyparker-rules/src/rule.rs b/crates/noseyparker-rules/src/rule.rs index 28ffdfd7f..08c70affe 100644 --- a/crates/noseyparker-rules/src/rule.rs +++ b/crates/noseyparker-rules/src/rule.rs @@ -87,10 +87,10 @@ impl RuleSyntax { /// references: vec![], /// categories: vec![], /// }; - /// assert_eq!(r.as_anchored_regex().unwrap().as_str(), r"hello\s*world$"); + /// assert_eq!(r.as_anchored_regex().unwrap().as_str(), r"hello\s*world\z"); /// ``` pub fn as_anchored_regex(&self) -> Result { - Self::build_regex(&format!("{}$", self.uncommented_pattern())) + Self::build_regex(&format!(r"{}\z", self.uncommented_pattern())) } /// Compute the content-based structural ID of this rule.