title: regular expression to check text for date format not working as expected
body: <p>I have a function to check a part of my html page for structure. I basically want to identify if div elements start with a date in the text/content or not. if so, then I would like to alter the HTML (but that is out of scope for this question.</p>
  
  <p>My control is as followed:</p>
  
  <pre><code>function isDate(_date){
      const _regExp  = new RegExp('^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9]) (2[0-3]|[01][0-9]):([0-5][0-9])?$');
      return _regExp.test(_date);
  }
  
  $(function() {
      var entries = $("div.histEntry");
  
      console.log('2018-08-01 18:30 is Date? ' + isDate('2018-08-01 18:30'));
      console.log('hungry like a wolf is Date? ' + isDate('hungry like a wolf'));
  
      $("div.histEntry").each(function( index, value ) {
        console.log('content of div: ' + $(this).text());
        console.log('text to check: ' + $(value).text().substring(0, 17));
        console.log('is Date?: ' + isDate($(value).text().substring(0, 17)));
      });
  
  });
  </code></pre>
  
  <p>Here is a snippet from what I get returned in the console:</p>
  
  <pre><code>2018-08-01 18:30 is Date? true
  hungry like a wolf is Date? false
  content of div: 
  2019-04-12 13:55 John Doe/Web/ACME created this document
  text to check: 
  2019-04-12 13:55
  is Date?: false
  content of div: 
  2019-04-15 14:03 Office Manager changed from Jim Joe to Billy Boy
  text to check: 
  2019-04-15 14:03
  is Date?: false
  content of div: 
  Mikael commented this document
  text to check: 
  Mikael commented
  is Date?: false
  </code></pre>
  
  <p>Why is 2018-08-01 18:30 seen as date and 2019-04-15 14:03 not?</p>