[Documentation] Add docs explaining the differences between Regex Source generator vs the inbox engines when using RegexOptions.IgnoreCase #70214
Labels
area-System.Text.RegularExpressions
documentation
Documentation bug or enhancement, does not impact product or test code
Milestone
cc: @GrabYourPitchforks @stephentoub
Today, when using RegexOptions.IgnoreCase, Regex will use the regex case equivalence table to transform the pattern into a case-insensitive equivalent pattern in order to be able to perform the searches in a more performant way. For example, it will convert the case-insensitive pattern
A|B
into a case-sensitive[Aa]|[Bb]
pattern. When using the source generator, this transformation happens at build time since the case-sensitive pattern is embedded into the resulting assembly/program. This is why it is important to call out a couple of differences in terms of behavior that this could result in when compared to using a non-source-generator engine in Regex:CurrentCulture
is important when determining which case-mappings will be used to perform the transformation, since there are some (very few) cases where mappings change depending on the culture. When using the source generator, the culture used for determining which bindings to use will be selected at build-time, while if you were using one of the built-in engines, the culture used for determining which bindings to use will be selected at runtime.This issue will be used to track the work of adding official documentation to call out these differences between source generator engines and the built-in engines.
Related: #69039
The text was updated successfully, but these errors were encountered: