code refactored and optimized
modified email regex, code optimized