Put back Regex singleton optimization
authorStephen Toub <stoub@microsoft.com>
Mon, 16 Dec 2019 19:45:08 +0000 (14:45 -0500)
committerStephen Toub <stoub@microsoft.com>
Thu, 9 Jan 2020 03:50:08 +0000 (22:50 -0500)
commitb9d5e91e4c4e61eb6acc981326ecf79e8c4e8bab
tree96e8034efd49127a870885f1515007d60088ec7e
parent40d550f793e41ad4d2e43aa382c1bdbee891d0bf
Put back Regex singleton optimization

I had removed it because it seemed illogical that anyone would write such character classes.  But it turns out the implementation/parser itself generates them for certain forms, e.g. "hello|hithere" will create a character class containing just 'h' in order to find the start of the alternation.
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCharClass.cs
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompiler.cs
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexNode.cs