Error: Non-ECMAScript regexes are not currently supported.

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
sd1388
Posts: 34
Joined: Mon Jan 30, 2017 9:51 am

Error: Non-ECMAScript regexes are not currently supported.

Postby sd1388 » Tue Apr 25, 2017 4:24 am

Hi Team,

while migrating below code, I got error - Error: Non-ECMAScript regexes are not currently supported. in Java script.

Code: Select all

 string patternLenient = @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
                System.Text.RegularExpressions.Regex reLenient = new System.Text.RegularExpressions.Regex(patternLenient);

                //Validate Emailid
                if (!reLenient.IsMatch(TxtEmail.Text.Trim()))
                {
                    // code
                }


Is it known issue?
If yes, is there alternatives to validate email.

Thanks.

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: Error: Non-ECMAScript regexes are not currently supported.

Postby JS-Support @Userware » Tue Apr 25, 2017 4:53 am

Hi,

Please use the code below to validate the email:

Code: Select all

private void ButtonCheckIfEmailAddressIsValid_Click(object sender, RoutedEventArgs e)
{
    if (Regex.IsMatch(TextBoxEmailAddress.Text, @"^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"))
        MessageBox.Show(TextBoxEmailAddress.Text + " is a valid email address.");
    else
        MessageBox.Show(TextBoxEmailAddress.Text + " is NOT a valid email address.");
}


PS: you can find a CSHTML5-based Regular Expressions "Playground" in the "Other" section of the Showcase app at:
http://cshtml5.com/samples/showcase/index.html?20170308

Thanks.
Regards,
JS-Support


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 3 guests

 

 

cron