You don ' t parse HTML with a regex regular expression because HTML is not regular . HTML elements can be nested in arbitrary orders to arbitrary depths and a regex is insufficient to validate what tags have been correctly closed because it cannot remember what tags have been opened . If you want to parse HTML , use an HTML or XML parser . You don ' t validate email addresses with regex because email addresses are incredibly complicated . Here are some examples adminlocalhost and admin are valid addresses . adminexample . com , adminamazonspamexample . com , and , depending on your mailserver , amazonspamadmin . example . com are all valid and are the same address . adminexample . com and Adminexample . com are the same address , unless they ' re not . adminthis guy is an assholeexample . com is valid . example . com is valid . Email addresses are defined as LocalPartServer . You basically can ' t make any assumptions at all about what is valid for the local part , because different mail servers can and will handle it differently . The RFCs say you can ' t have more than one period in the local part of an email address , but gmail completely ignores them altogethermdash abcdefggmail . com and abcd . efggmail . com will go to the same mailbox . This is a feature of gmail and not part of the spec . So what about the server ? Surely there are rules for that ! Just one , and it ' s more of a suggestion Ideally , you can route to it . Domain names can contain unicode characters , including emojis . You can direct email to an IPv 6 server , or to an IPv 4 server in either octal or base 10 . Sendmail and others surely , but I know sendmail respects the contents of the hosts file , so depending on your use case , Sharonmarketing might be a valid address . So let ' s say you craft the greatest email regex of all time something even more arcane than parrot . com ~ pdwMailRFC 822 Address . html , which still fails to validate the adminthis guy is an assholeexample . com case . and are 100 % certain that the address could be valid . You still don ' t know if it is . akfj 18351 example . com is valid , but it may not exist . joeexample . com may exist , but it may not actually be the user ' s email address . You ' re going to have to send them a confirmation email anyway to validate that the address works , otherwise you ' ve defeated the entire purpose of asking them for an email address . So if you ' re doing that anyway , why did you spend the last 8 years of your life crafting the Excalibur of email validation regexes when you could ' ve used . . and called it a day ?