正则匹配指定长度的数字要怎么写?
我只想匹配其中长度为10的那些数字,我要怎么写正则?
——解决方案————-本文@来#源gaodai$ma#com搞$$代**码网搞代gaodaima码——-
- PHP code
$str=<<<htm1234567890 1234567890123 0987654321 3210987654321 1324354657 1324354657689 htm;preg_match('/(
[\d]{10}<\/td>)/',$str,$match);print_R ($match[1]);
------解决方案--------------------PHP code
<?php$str=<<<htm1234567890 1234567890123 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);