regex - How can I extract all 4-digit numbers from a php text? -


for example : had text testt1591fff44f43f0015ffef159 given there won't more 4 consecutive number in string, how can extract 1591 , 0015 out of php?

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

<?php $text = 'testt1591fff44f43f0015ffef159';  preg_match_all('~\d{4}~',  $text, $matches);  ?> 

didnot test code


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -