rspec/rules/S5856/why-dotnet.adoc

8 lines
1020 B
Plaintext
Raw Normal View History

2023-06-05 18:08:52 +02:00
== Why is this an issue?
https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expressions[Regular expressions] have their own syntax that is understood by regular expression engines. Those engines will throw an exception at runtime if they are given a regular expression that does not conform to that syntax.
To avoid syntax errors, special characters should be https://learn.microsoft.com/en-us/dotnet/standard/base-types/character-escapes-in-regular-expressions[escaped with backslashes] when they are intended to be matched literally and references to capturing groups should use the correctly spelled name or number of the group.
Negative https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference#lookarounds-at-a-glance[lookaround] groups cannot be combined with https://learn.microsoft.com/en-us/dotnet/standard/base-types/backtracking-in-regular-expressions[RegexOptions.NonBacktracking]. Such combination would throw an exception during runtime.