Why are regular season only finds the last match?

Hi friends.

Trying to get the text links are in table cells are. Preg_match_all but gives me only the last match, and need the list.

$content = 'sdf<a class="123">777777</a><a class="123">888888</a>';
$pattern = '~<a.*>([0-9]{5,})<\/a><\/td>~mui';
preg_match_all($pattern, $content, $matches); // only finds 888888</a.*>


I did not write in the regular season?
June 8th 19 at 16:36
3 answers
June 8th 19 at 16:38
Solution
$pattern = '~<a.*?>([0-9]{5,})<\/a><\/td>~mui';</a.*?>
if you want to skip attributes in the tag, it is best to use
[^<>]*? - nikolas.Reichert commented on June 8th 19 at 16:41
thank you! - audrey_Kautz commented on June 8th 19 at 16:44
June 8th 19 at 16:40
Solution
$pattern = '~<a.*?>([0-9]{5,})<\/a><\/td>~mui';</a.*?>
thank you! - nikolas.Reichert commented on June 8th 19 at 16:43
June 8th 19 at 16:42
the greediness of the quantifiers

Find more questions by tags Regular expressions