<?php$a="hola.ggg.s";if (preg_match('/^(\w|\d)*\.(\w|\d)*\.(\w|\d)*$/',$a,$res)){ echo "bien"; }else{ echo "mal"; }?>