Skip to content

Commit b0be9df

Browse files
committed
[#331] Re-introduce boundary check
This improves the regex evaluation back to when we still had `\b` in front, while (hopefully) doing as it should
1 parent 85270ac commit b0be9df

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/DynamicExpresso.Core/Detector.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ internal class Detector
1212
private readonly ParserSettings _settings;
1313

1414
private static readonly Regex RootIdentifierDetectionRegex =
15-
new Regex(@"(?<id>@?[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}_]*)", RegexOptions.Compiled);
15+
new Regex(@"(?<=[^\w@]|^)(?<id>@?[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}_]*)", RegexOptions.Compiled);
1616

1717
private static readonly Regex ChildIdentifierDetectionRegex = new Regex(
18-
@"(?<id>@?[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}_]*(\.[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}_]*)*)",
18+
@"(?<=[^\w@]|^)(?<id>@?[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}_]*(\.[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}_]*)*)",
1919
RegexOptions.Compiled);
2020

2121

0 commit comments

Comments
 (0)