title: Regular expressions in findstr
body: <p>I'm doing a little string validation with <code>findstr</code> and its <code>/r</code> flag to allow for regular expressions. In particular I'd like to validate integers.</p>
  
  <p>The regex</p>
  
  <pre><code>^[0-9][0-9]*$
  </code></pre>
  
  <p>worked fine for non-negative numbers but since I now support negative numbers as well I tried</p>
  
  <pre><code>^([1-9][0-9]*|0|-[1-9][0-9]*)$
  </code></pre>
  
  <p>for either positive or negative integers or zero.</p>
  
  <p>The regex works fine <em>theoretically</em>. I tested it in PowerShell and it matches what I want. However, with</p>
  
  <pre><code>findstr /r /c:"^([1-9][0-9]*|0|-[1-9][0-9]*)$"
  </code></pre>
  
  <p>it doesn't.</p>
  
  <p>While I know that <code>findstr</code> doesn't have the most advanced regex support (even below Notepad++ which is probably quite an achievement), I would have expected such simple expressions to work.</p>
  
  <p>Any ideas what I'm doing wrong here?</p>