我只想匹配其中长度为10的那些数字,我要怎么写正则?
------解决方案--------------------
- PHP code
$str=<<1234567890 1234567890123 0987654321 3210987654321 1324354657 1324354657689 htm; preg_match('/([\d]{10}<\/td>)/',$str,$match); print_R ($match[1]);
------解决方案--------------------PHP code
12345678901234567890123 0987654321 3210987654321 1324354657 1324354657689 htm; preg_match_all('/([\d]{10}\b<\/td>)/',$str,$match); print_R ($match[1]);
------解决方案--------------------PHP code
preg_match_all('/(\d{10}\b)<\/td>/',$str,$matchs); print_r ($matchs);
------解决方案--------------------
把函数改成 preg_match_all 就行了
preg_match_all('/([\d]{10}<\/td>)/',$str,$match);