如何从php文本中提取所有4位数字?

Abb*_*Hoi 0 php regex

例如:我有一个文本,testt1591fff44f43f0015ffef159假设该字符串中不会有超过4个连续数字,我如何通过PHP从中提取1591和0015?

MKr*_*ers 5

http://www.php.net/manual/en/function.preg-match-all.php

<?php
$text = 'testt1591fff44f43f0015ffef159';

preg_match_all('~\d{4}~',  $text, $matches);

?>
Run Code Online (Sandbox Code Playgroud)

没有测试代码