preg_match only 4 digits numbers

php, regex

Solution

Change the pattern to:

$pattern = '#<b>([0-9]{4})</b>#';

Problem

Im trying to get all the 4 digit numbers from this website, However there are some numbers that are less than 4 digits for example #20 in the array is value 20. ``` Array ( [0] => 6280 [1] => 6279 [2] => 6278 [3] => 6277 [4] => 6276 [5] => 6275 [6] => 6274 [7] => 6273 [8] => 6272 [9] => 6271 [10] => 6270 [11] => 6269 [12] => 6268 [13] => 6267 [14] => 6266 [15] => 6265 [16] => 6264 [17] => 6263 [18] => 6262 [19] => 6261 [20] => 20 [21] => 6320 ) ``` This is the script im using: ``` $pattern = '#<b>([0-9]+)</b>#'; preg_match_all($pattern,$website,$match_number); ``` Is it possible to only get it if there are 4 digits no less no more. Thanks

Original source