Why does this regex have 3 matches, not 5?

Levey

New Member
I wrote a pretty simple preg_match_all file in PHP:\[code\]$fileName = 'A_DATED_FILE_091410.txt';$matches = array();preg_match_all('/[0-9][0-9]/',$fileName,$matches);print_r($matches);\[/code\]My Expected Output:\[code\]$matches = array( [0] => array( [0] => 09, [1] => 91, [2] => 14, [3] => 41, [4] => 10 ))\[/code\]What I got instead:\[code\]$matches = array( [0] => array( [0] => 09, [1] => 14, [2] => 10 ))\[/code\]Now, in this particular use case this was preferable, but I'm wondering why it didn't match the other substrings? Also, is a regex possible that would give me my expected output, and if so, what is it?
 
Back
Top