diff --git a/jsonpath-compliance-test-suite b/jsonpath-compliance-test-suite index 31dec17..7c8e9bc 160000 --- a/jsonpath-compliance-test-suite +++ b/jsonpath-compliance-test-suite @@ -1 +1 @@ -Subproject commit 31dec1720dc9b9d3e8af3c61f025da93ceb6c9d1 +Subproject commit 7c8e9bcd92f8ed8797331de02f488ebcb7856bec diff --git a/serde_json_path/src/parser/selector/function/registry.rs b/serde_json_path/src/parser/selector/function/registry.rs index e52a3fc..1a9e88d 100644 --- a/serde_json_path/src/parser/selector/function/registry.rs +++ b/serde_json_path/src/parser/selector/function/registry.rs @@ -53,10 +53,12 @@ fn count(nodes: NodesType) -> ValueType { #[serde_json_path_macros::register(name = "match", target = MATCH_FUNC)] fn match_func(value: ValueType, rgx: ValueType) -> LogicalType { match (value.as_value(), rgx.as_value()) { - (Some(Value::String(s)), Some(Value::String(r))) => Regex::new(format!("^({r})$").as_str()) - .map(|r| r.is_match(s)) - .map(Into::into) - .unwrap_or_default(), + (Some(Value::String(s)), Some(Value::String(r))) => { + Regex::new(format!("(?R)^({r})$").as_str()) + .map(|r| r.is_match(s)) + .map(Into::into) + .unwrap_or_default() + } _ => LogicalType::False, } } @@ -64,10 +66,12 @@ fn match_func(value: ValueType, rgx: ValueType) -> LogicalType { #[serde_json_path_macros::register(target = SEARCH_FUNC)] fn search(value: ValueType, rgx: ValueType) -> LogicalType { match (value.as_value(), rgx.as_value()) { - (Some(Value::String(s)), Some(Value::String(r))) => Regex::new(r.as_str()) - .map(|r| r.is_match(s)) - .map(Into::into) - .unwrap_or_default(), + (Some(Value::String(s)), Some(Value::String(r))) => { + Regex::new(format!("(?R)({r})").as_str()) + .map(|r| r.is_match(s)) + .map(Into::into) + .unwrap_or_default() + } _ => LogicalType::False, } }