oppure (forse per cose un po' più complesse) usare ereg o preg_match