I have a .NetStandard2.1 C# application that needs to run Regex in the ECMAScript flavor.
According to MSDN documentation, I can use RegexOptions.ECMAScript:
Enables ECMAScript-compliant behavior for the expression.
I know that \A anchor is not supported in ECMAScript (According to link and when I tried Regex101 with the ECMAScript option). But it seems that .Net does support it. Example:
Regex emcaRegex = new Regex(@"\A\d{3}", RegexOptions.ECMAScript);
var matches = emcaRegex.Matches("901-333-");
Console.WriteLine($"number of matches: {matches.Count}"); // number of matches: 1
Console.WriteLine($"The match: {matches[0]}"); // The match: 901
I expect to get not matches at all, what am I missing?