you could simply check ``if (!preg_match)``. All falsy values returned by preg_match are about not matching.