I have these two regex, both for validating email. The first one is from ASP.NET email regex validator and the second one I found on SO. My question is what is the the difference between them and which one is better?
/^\w+([-+.\']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/
/^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
Both regex allow the ukkkk
<script type="text/javascript">
var regex = /^\w+([-+.\']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
var regex2 = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
alert(regex.test('nhassyk@yahoo.co.ukkkk'));
alert(regex2.test('nhassyk@yahoo.co.ukkkk'));
</script>