$re = '/2(?:12|4[1-9]|5[1-9]|6[0-9]|7[0-8]|8[1-35-8]|9[1-5]|3[45789])|4(?:1[246]|2[46])/m';
$str = '248, 281, 282, 283, 235, 247, 278, 243, 244, 245, 246, 273, 278, 235, 285, 286, 288,
241, 242, 243, 245, 249, 258, 287, 212, 259, 268, 269, 237, 235, 238, 246, 247, 251,
252, 253, 271, 273, 274, 275, 212, 234, 239, 287, 291, 292, 295, 255, 256, 257, 293,
294, 276, 277, 271, 272, 212, 251, 253, 254, 261, 262, 263, 264, 265, 266, 267, 271,
275, 260, 270, 412, 414, 424, 416, 426';
$subst = "";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php