From c72e5a3568e21557b67fca69ca5cc372c4a7e713 Mon Sep 17 00:00:00 2001 From: Jo-Be-Co Date: Tue, 14 Apr 2026 02:48:03 +0200 Subject: [PATCH] fixed matching of first property --- .../NamingTemplate/ConditionalTagCollection[TClass].cs | 9 ++++++--- .../_Tests/LibationFileManager.Tests/TemplatesTests.cs | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/FileManager/NamingTemplate/ConditionalTagCollection[TClass].cs b/Source/FileManager/NamingTemplate/ConditionalTagCollection[TClass].cs index 0f6b0ba8..01f4050c 100644 --- a/Source/FileManager/NamingTemplate/ConditionalTagCollection[TClass].cs +++ b/Source/FileManager/NamingTemplate/ConditionalTagCollection[TClass].cs @@ -156,11 +156,14 @@ public partial class ConditionalTagCollection(bool caseSensitive = true) ^<(?!)? # tags start with a '<'. Condtionals allow an optional ! captured in to negate the condition {TagNameForRegex()} # next the tagname needs to be matched with space being made optional. Also escape all '#' \s+ # Separate the following with whitespace - (?(?: # capture the + (? # capture the '(?:[^']|'')*' # - allow 'string' to be included in the format, with '' being an escaped ' character | "(?:[^"]|"")*" # - allow "string" to be included in the format, with "" being an escaped " character - | [^:\#!≡=≠~<>≤≥&∉∌∈∌⋂⊆⊇⊂⊃-] # - match any character with some exclusions that should only be used in operands - ) +? (? end with a whitepace. Otherwise "" would be matchable. + | (?: \[ (?: \\. # - properties may have optional formatting details enclosed in '[' and ']'. '\' escapes allways the next character + | [^\\\]] # unescaped characters except ']' and '\' are allowed in the formatting details + )* \] # closing the formatting details part + | . )+? # - match any character to form the property name. Capture non greedy so it won't match the operator part. + (? end with a whitepace. Otherwise "" would be matchable. \s+ # Separate the following operand with whitespace (? # capture operator in and with every char escapable [\#!≡=≠~<>≤≥&∉∌∈∌⋂⊆⊇⊂⊃-]+ # allow a wide range of operators, all non alphanumeric diff --git a/Source/_Tests/LibationFileManager.Tests/TemplatesTests.cs b/Source/_Tests/LibationFileManager.Tests/TemplatesTests.cs index a09cc652..997a6cad 100644 --- a/Source/_Tests/LibationFileManager.Tests/TemplatesTests.cs +++ b/Source/_Tests/LibationFileManager.Tests/TemplatesTests.cs @@ -639,7 +639,7 @@ namespace TemplatesTests [DataRow("true<-cmp>", "true")] [DataRow("false<-cmp>", "")] [DataRow("true<-cmp>", "true")] - [DataRow("true<-cmp>", "true")] + [DataRow("true<-cmp>", "true")] [DataRow("true<-cmp>", "")] [DataRow("true<-cmp>", "true")] [DataRow("true<-cmp>", "")]