fork download
  1. <?PHP
  2. header('Content-Type: text/plain; charset=utf8');
  3. $regexPattern = "/([a-z]+ [0-9]{4})/i"; //This will match a letters + space + 4 digit number together
  4. $inputString = "juny 2014 october 2014 february 2016 march 2017 july 2010 FEBRUARY 2014";
  5. $matchCount = preg_match_all($regexPattern, $inputString, $matches);
  6. print_r($matches);
  7. ?>
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [0] => juny 2014
            [1] => october 2014
            [2] => february 2016
            [3] => march 2017
            [4] => july 2010
            [5] => FEBRUARY 2014
        )

    [1] => Array
        (
            [0] => juny 2014
            [1] => october 2014
            [2] => february 2016
            [3] => march 2017
            [4] => july 2010
            [5] => FEBRUARY 2014
        )

)