I tried the following regular expression to deny the user from entering email ID such as joooohn.smiiiithhh@xxxdddd.xxx
@"^((?!\1{2,})([\w-]+\.)+[\w-]+|([a-zA-Z]{1}|[\w-]{2,}))(?!\1{2,})@((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])(?!\1{2,})\.
([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])(?!\1{2,})\.
([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])(?!\1{2,})\.
(?!\1{2,})([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|([a-zA-Z]+[\w-]+\.)
(?!\1{2,})+(?!\1{2,})[a-zA-Z]{2,4})$"
But It didn't work. Can anyone help
Edit: 1. Not more than twice can a character appear.