js validation improved using regex