I am trying to validate an email using the regular expressions. I alomost done but I am failing in one condtion alone which is "a '-' (hyphen) should not be followed by '@'". I tried in different ways but nothis worked. Below is the regex I am currently using.
regex = /^(?!.*\.{2})[a-zA-Z0-9][a-zA-Z0-9#$%&\*\+-/=\?\_`|~]*@[a-zA-Z0-9][a-zA-Z0-9-_.]*\.[a-zA-Z]{2,4}$/;
PS : I know the the above regex stops for using two consecutive periods but its my project requirement :(
Please help me in validating for '-' followed by '@' and vice-versa.
Thanks, Yeshwanth