Hmm... something like:
([a-zA-Z0-9\,\"\'-\s] [a-zA-Z0-9\,\"\'-\s] [a-zA-Z0-9\,\"\'-\s] [a-zA-Z0-9\,\"\'-\s] [a-zA-Z0-9\,\"\'-\s]) ([a-zA-Z0-9\,\"\'-\s]).
it would match at least 5 words (with numbers)...
$pattern = "~([a-zA-Z0-9\,\"\'\-\s]* [a-zA-Z0-9\,\"\'\-\s]* [a-zA-Z0-9\,\"\'\-\s]* [a-zA-Z0-9\,\"\'\-\s]* [a-zA-Z0-9\,\"\'\-\s]*) ([a-zA-Z0-9\,\"\'\-\s]*)\.~";
$sent = 'This is a sentence of 7 words. I am a man of few words. This sucks. How about 5 words only.';
preg_match_all($pattern, $sent, $matches);
echo '<pre>';
var_dump($matches);
Outputs:
array(3) {
[0]=>
array(3) {
[0]=>
string(30) "This is a sentence of 7 words."
[1]=>
string(26) " I am a man of few words."
[2]=>
string(25) " How about 5 words only."
}
[1]=>
array(3) {
[0]=>
string(23) "This is a sentence of 7"
[1]=>
string(19) " I am a man of few"
[2]=>
string(19) " How about 5 words"
}
[2]=>
array(3) {
[0]=>
string(5) "words"
[1]=>
string(5) "words"
[2]=>
string(4) "only"
}
}
You can modify it as you want, but this also takes into account hyphenated words (non-payer) and quotes (Sally said "yes", I'm okay with that).
Hope that helps....