title: Bash regex not recognizing a single space " "
body: <p>I'm trying to solve a problem that appeared in my script which doesn't let me match the date+time (YYYY-MM-DD HH:MM:SS) inside a for loop</p>
  <pre><code>list='&quot;dt_txt&quot;:&quot;2022-06-03 21:00:00&quot;},'
  
  regex_datehour='&quot;dt_txt&quot;:&quot;([0-9,-]*.[0-9,:]*)'
  
  
  
  
  for i in $list; do
      [[ $i =~ $regex_datehour ]] &amp;&amp; echo &quot;${BASH_REMATCH[1]}&quot;
  done
  </code></pre>
  <p>It seems that the &quot;<code>.</code>&quot; between the two pair of brackets it's not recognizing the space! that's because inside of the list, if I replace the empty space between the date and the time by a <code>_</code>, it works as intended! <code>list='&quot;dt_txt&quot;:&quot;2022-06-03_21:00:00&quot;},'</code></p>
  <p>desired output:</p>
  <pre><code>2022-06-03 21:00:00
  </code></pre>
  <p>what I get:</p>
  <pre><code>2022-06-03
  </code></pre>