I am wondering if there is a good tool that translates RegEx from .NET(C#) syntax to Javascript, including all escaping rules. I have a RegEx that works in .NET inside RegExValidator but doesn’t work inside Javascript:
^\s*\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*\s*$
Javascript doesn’t like apostrophy inside RegEx when used like sample below, but .NET didn’t have a problem with that.
$('#<%= ContactEMail.ClientID %>').blur(function() {
if ((^\s*\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*\s*$)).test($(this).val())
{
$(this).next('span').show();
}
else
{
$(this).next('span').hide();
}
});
Try this:
Match info: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/match
Hope help