improve email pattern function