title: Regex to match a variable in Batch scripting
body: <pre><code>@echo off
  
  SET /p var=Enter: 
  echo %var% | findstr /r "^[a-z]{2,3}$"&gt;nul 2&gt;&amp;1
  if errorlevel 1 (echo does not contain) else (echo contains)
  pause
  </code></pre>
  
  <p>I'm trying to valid a input which should contain 2 or 3 letters. But I tried all the possible answer, it only runs <code>if error level 1 (echo does not contain)</code>.</p>
  
  <p>Can someone help me please. thanks a lot.</p>