php如何连续检查超过5个辅音的字符串

As a spam filter I want to block any comments that contain

djgalkgjlkdg

or any other excessive amount of consonants in a row.

I thought of maybe having an array of consonants and then check the comment with it, but seems too long and cumbersome.

Do you know of any way I can do this without guzzling memory?

preg_match('/[bcdfghjklmnpqrstvwxz]{6}/i', $input) perhaps?

if(preg_match("~[bcdfghjklmnpqrstvwxyz]{4,}~", $string)......

Matches any alphabetic character but numbers:

/i at the end makes it case insensitive.

$find = '/([b-df-hj-np-tv-z]{4})/i';
if(preg_match($find,$comment)){
   //spam filter action
}