fork download
  1. <?php
  2. $re = "#href=[\"']?(\d{4}(?:[-_]\d{2})+)[\"']?#";
  3. $str = "href=\"XXXX-XX-XX\"\n\nhref=\"2015-05-15\",\nhref=\"2015-05-15_03_21_32\"\nhref=\"2014-12-21\"";
  4. preg_match_all($re, $str, $matches);
  5. print_r($matches);
Success #stdin #stdout 0.01s 24448KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [0] => href="2015-05-15"
            [1] => href="2015-05-15_03_21_32"
            [2] => href="2014-12-21"
        )

    [1] => Array
        (
            [0] => 2015-05-15
            [1] => 2015-05-15_03_21_32
            [2] => 2014-12-21
        )

)