Replacing simple preg_match with inexpensive substr and strlen.