From 006f4636270f7b3a0166be88cd3ed6c6443de274 Mon Sep 17 00:00:00 2001 From: Michal Moskal Date: Wed, 11 Dec 2024 15:51:56 +0100 Subject: [PATCH] fix json regex anchoring --- parser/src/json/compiler.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/parser/src/json/compiler.rs b/parser/src/json/compiler.rs index 00e9f82..2e3cc4d 100644 --- a/parser/src/json/compiler.rs +++ b/parser/src/json/compiler.rs @@ -571,7 +571,10 @@ impl Compiler { if !left_anchored { result.push_str(".*"); } + // without parens, for a|b we would get .*a|b.* which is (.*a)|(b.*) + result.push_str("("); result.push_str(trimmed); + result.push_str(")"); if !right_anchored { result.push_str(".*"); }