title: How do I write regex to validate EIN numbers?
body: <p>I want to validate that a string follows this format (using regex):</p>
  
  <pre><code>valid: 123456789     //9 digits
  valid: 12-1234567    // 2 digits + dash + 7 digits
  </code></pre>
  
  <p><strong>Here's an example, how I would use it:</strong></p>
  
  <pre><code>var r = new Regex("^[1-9]\d?-\d{7}$");
  Console.WriteLine(r.IsMatch("1-2-3"));
  </code></pre>
  
  <p>I have the regex for the format with dash, but can't figure how to include the non-dash format???  </p>