Skip to content

Commit

Permalink
Use \z instead of $ for anchoring regexes for 2-stage Vectorscan+rege…
Browse files Browse the repository at this point in the history
…x matching
  • Loading branch information
bradlarsen committed Dec 9, 2024
1 parent 8d6963a commit 4d6a38f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/noseyparker-rules/src/rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<regex::bytes::Regex> {
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.
Expand Down

0 comments on commit 4d6a38f

Please sign in to comment.