I want to validate hostnames (ie x.y.z format). Currently I'm using the regular expression below, but it is not working.
It accepts x.y.z.a etc. I want to restrict it to only accept x.y.z. Does anyone know how I can fix it?
/^([a-z0-9]+(-[a-z0-9]+)*\.)+([a-z]{2,12})$/i