title: Regular expression works in tester but not in my code
body: <p>This is my code. </p>
  
  <pre><code>        static void Main(string[] args)
          {
              string pattern = 
  @"^(?&lt;p1&gt;.*?)(?&lt;c0&gt;\w+)(?&lt;s1&gt;.*?)$
  ^(?&lt;p2&gt;.*?)\k&lt;c0&gt;(?&lt;s2&gt;.*?)$
  ^\k&lt;p1&gt;(?&lt;c1&gt;\w+)\k&lt;s1&gt;$
  ^\k&lt;p2&gt;\k&lt;c1&gt;\k&lt;s2&gt;$";
  
              string text = 
  @"            if (forwardRadioButton.IsChecked.Value)
                  car = car.Forward(distance);
              else if (backwardRadioButton.IsChecked.Value)
                  car = car.Backward(distance);
              else if (forwardLeftRadioButton.IsChecked.Value)
                  car = car.ForwardLeft(distance);";
  
              var mc = Regex.Matches(text, pattern, RegexOptions.IgnoreCase | RegexOptions.Multiline);
  
              Console.WriteLine(mc.Count);
              Console.ReadKey();
          }
  </code></pre>
  
  <p>It cannot find a match.
  <img src="https://i.stack.imgur.com/oARdc.png" alt="enter image description here"></p>
  
  <p>But if I test the regular expression and the text in a .NET Tester, it can find a match.</p>
  
  <p><img src="https://i.stack.imgur.com/z5VnF.png" alt="enter image description here"></p>
  
  <p>Do I miss anything in my code? How to make the pattern work?</p>