title: Why running .Net Regex with ECMAScript flavor support \A
body: <p>I have a <code>.NetStandard2.1</code> <code>C#</code> application that needs to run <code>Regex</code> in the <code>ECMAScript</code> flavor.</p>
  <p>According to <a href="https://docs.microsoft.com/en-us/dotnet/api/system.text.regularexpressions.regexoptions?view=net-5.0" rel="nofollow noreferrer">MSDN documentation</a>, I can use <code>RegexOptions.ECMAScript</code>:</p>
  <blockquote>
  <p>Enables ECMAScript-compliant behavior for the expression.</p>
  </blockquote>
  <p>I know that <code>\A</code> anchor is not supported in <code>ECMAScript</code> (According to <a href="https://gist.github.com/CMCDragonkai/6c933f4a7d713ef712145c5eb94a1816" rel="nofollow noreferrer">link</a> and when I tried <a href="https://regex101.com/" rel="nofollow noreferrer">Regex101</a> with the ECMAScript option). But it seems that .Net does support it. Example:</p>
  <pre><code>Regex emcaRegex = new Regex(@&quot;\A\d{3}&quot;, RegexOptions.ECMAScript);
  var matches =  emcaRegex.Matches(&quot;901-333-&quot;);
  
  Console.WriteLine($&quot;number of matches: {matches.Count}&quot;); // number of matches: 1
  Console.WriteLine($&quot;The match: {matches[0]}&quot;); // The match: 901
  </code></pre>
  <p>I expect to get not matches at all, what am I missing?</p>