title: Preg_match for a date
body: <p>I am trying to match a date in PHP using preg_match, split it and assign parts of it to an array, the date looks like "20100930", here is the code I am using:</p>
  
  <pre><code>// Make the tor_from date look nicer
  $nice_from = $_POST['tor_from'];
  
  $matches = array();
  $ideal_from = '';
  preg_match('/\d{4}\\d{2}\\d{2}\/', $nice_from, $matches, PREG_OFFSET_CAPTURE, 0);
  // if (isset($matches[0])) $nice_from = $matches[0];
  echo $matches[0];
  echo "&lt;br /&gt;";
  echo $matches[1];
  echo "&lt;br /&gt;";
  echo $matches[2];
  echo "&lt;br /&gt;";
  echo $matches[3];
  echo "&lt;br /&gt;";
  </code></pre>
  
  <p>Ive been using:
  <a href="http://php.net/manual/en/function.preg-match.php" rel="nofollow noreferrer">http://php.net/manual/en/function.preg-match.php</a> and <a href="https://stackoverflow.com/questions/1179165/php-preg-match-question">PHP preg_match question</a> to formulate ideas on how to do this, however I have had no luck in getting it to work. Any help would be greatly appreciated.</p>