Shell REGEX for date
<p>I am trying to fix the users input if they input an incorrect date format that is not (YYYY-MM-DD) but I cant figure it out. Here is what I have:</p>

<pre><code>while [ "$startDate" != "^[0-9]{4}-[0-9]{2}-[0-9]{2}$" ]
do
  echo "Please retype the start date (YYYY-MM-DD):"
  read startDate
done
</code></pre>