How do I write a number with the specified length for regular expression matching? & Lt; td & gt; 1234567890 & lt; td & gt; 1234567890123 & lt; td & gt; 0987654321 & lt; td & gt; 3210987654321 & lt; td & gt; 1324354657 & lt; td & gt; & how do I write a number with the specified length for regular expression matching?
1234567890
1234567890123
0987654321
3210987654321
1324354657
1324354657689
I only want to match the numbers with a length of 10. how do I write regular expressions?
------ Solution --------------------
PHP code
$ Str = <
123456789012345678901230987654321321098765432113243546571324354657689Htm; preg_match ('/([\ D] {10} <\/td>)/', $ str, $ match); print_R ($ match [1]);
------ Solution --------------------
PHP code
123456789012345678901230987654321321098765432113243546571324354657689Htm; preg_match_all ('/([\ D] {10} \ B <\/td>)/', $ str, $ match); print_R ($ match [1]);
------ Solution --------------------
PHP code
Preg_match_all ('/(\ D {10} \ B) <\/td>/', $ str, $ matchs); print_r ($ matchs );
------ Solution --------------------
Change the function to preg_match_all.
Preg_match_all ('/([\ D] {10} <\/td>)/', $ str, $ match );