title: Why does findstr not handle case properly (in some circumstances)?
body: <p>While writing some recent scripts in cmd.exe, I had a need to use <code>findstr</code> with regular expressions - customer required standard cmd.exe commands (no GnuWin32 nor Cygwin nor VBS nor Powershell).</p>
  
  <p>I just wanted to know if a variable contained any upper-case characters and attempted to use:</p>
  
  <pre><code>&gt; set myvar=abc
  &gt; echo %myvar%|findstr /r "[A-Z]"
  abc
  &gt; echo %errorlevel%
  0
  </code></pre>
  
  <p>When <code>%myvar%</code> is set to <code>abc</code>, that actually outputs the string and sets <code>errorlevel</code> to 0, saying that a match was found.</p>
  
  <p>However, the full-list variant:</p>
  
  <pre><code>&gt; echo %myvar%|findstr /r "[ABCDEFGHIJKLMNOPQRSTUVWXYZ]"
  &gt; echo %errorlevel%
  1
  </code></pre>
  
  <p>does <em>not</em> output the line and it correctly sets <code>errorlevel</code> to 1.</p>
  
  <p>In addition:</p>
  
  <pre><code>&gt; echo %myvar%|findstr /r "^[A-Z]*$"
  &gt; echo %errorlevel%
  1
  </code></pre>
  
  <p>also works as expected.</p>
  
  <p>I'm obviously missing <em>something</em> here even if it's only the fact that <code>findstr</code> is somehow broken.</p>
  
  <p>Why does the first (range) regex not work in this case?</p>
  
  <hr>
  
  <p>And yet more weirdness:</p>
  
  <pre><code>&gt; echo %myvar%|findstr /r "[A-Z]"
  abc
  &gt; echo %myvar%|findstr /r "[A-Z][A-Z]"
  abc
  &gt; echo %myvar%|findstr /r "[A-Z][A-Z][A-Z]"
  &gt; echo %myvar%|findstr /r "[A]"
  </code></pre>
  
  <p>The last two above also does not output the string!!</p>