title: How to combine two RegEx
body: <p>I've requirement like below</p>
  
  <pre><code>1234 1234567890 1234 (or 1234-1234567890-1234)
       1234567890 1234 (or 1234567890-1234)
  </code></pre>
  
  <p>Below are my ReqEx</p>
  
  <pre><code>(\d{4})[ -]?(\d{10})[ -]?(\d{4})
              (\d{10})[ -]?(\d{4})
  </code></pre>
  
  <p>Above expressions are works fine.</p>
  
  <pre><code>Regex validate = new Regex(@"(\d{4})[ -]?(\d{10})[ -]?(\d{4})");
  Console.WriteLine(validate.Replace("123412345678901234", "$1-$2-$3"));
  O/P: 1234-1234567890-1234
  
  Regex validate = new Regex(@"(\d{10})[ -]?(\d{4})");
  Console.WriteLine(validate.Replace("12341234567890", "$1-$2"));
  O/P: 1234-1234567890
  </code></pre>
  
  <p>However, How can i combine above 2 RegEx into single one.</p>
  
  <p>I've tried with "<code>(?:(\d{4})[ -])?(\d{10})[ -]?(\d{4})</code>" and is not working.</p>