$re = '/^(.{20})[^.]{4,}(.*)$/mi';
$str = '1.1234567890.ab
2.123456789012345678901.ab
3.1234567890123456789012.ab
4.12345678901234567890123.ab
5.123456789012345678901234.ab
6.1234567890123456789012345.ab
7.12345678901234567890123456.ab
8.123456789012345678901234567890.ab
9.123456789012345678901234567890.1234567890123456.7890.ab
0.123456789012345678901234567890.12345678901.234567890....abcdef012345
12345678901234567890123456789012345678901234567890';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
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