diff --git a/DEPENDENCIES b/DEPENDENCIES index dc15ee20d..28e6a0301 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -1,3 +1,3 @@ vendorpull https://github.com/sourcemeta/vendorpull 1dcbac42809cf87cb5b045106b863e17ad84ba02 -core https://github.com/sourcemeta/core 87a66bfc8f243640beb34998f35ff1dea5e77095 +core https://github.com/sourcemeta/core ac96b5fba550a5097d174c1681ba3155cb3e3914 jsonschema-test-suite https://github.com/json-schema-org/JSON-Schema-Test-Suite a247442bca7a4798ab6187e035200feacd5423ed diff --git a/vendor/core/src/core/regex/preprocess.h b/vendor/core/src/core/regex/preprocess.h index 227b41c40..b844aa2cf 100644 --- a/vendor/core/src/core/regex/preprocess.h +++ b/vendor/core/src/core/regex/preprocess.h @@ -618,12 +618,21 @@ inline auto preprocess_regex(const std::string &pattern) const bool starts_with_nested = !nested_content.empty() && nested_content[0] == '['; + // Check if the character after the simple bracket end continues + // the class with more v-flag syntax (another nested class or outer + // closing bracket). This distinguishes true v-flag nesting like + // [[a-z][A-Z]] from a literal [ inside a standard class like [[(] + const bool after_simple_continues_class = + simple_end < pattern.size() && + (pattern[simple_end] == '[' || pattern[simple_end] == ']'); + // Use v-flag mode if: // 1. Nested content has v-flag operators (-- or &&), OR // 2. Content starts with [ (indicating v-flag nested class syntax) - // AND the ends differ (so there's actual nesting being tracked) + // AND the ends differ AND the class continues after simple end const bool use_v_flag = - nested_has_ops || (starts_with_nested && simple_end != nested_end); + nested_has_ops || (starts_with_nested && simple_end != nested_end && + after_simple_continues_class); if (use_v_flag) { const auto expanded = expand_char_class(nested_content);