Error when trying to verify the email of a registration form

I’m trying to verify, but when trying to validate the email I always get an error.
This is the code I am using.

if (!/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)/.test(v_email)){

        mensajeError.push ("
The email is not valid <br>");
    }

What is the error? What else have you tried?

What happens is that it does not matter if the email they enter in the form is wrong or well written, it always says that “The email is not valid”. Try putting the regurlar expression in quotes as well, but it doesn’t even check when I do that.

I think that you probably want to spend some more time looking at your regular expression. I really like https://regex101.com/ as a tool for building and testing regular expressions. Their Unit Tests functionality is especially useful.

In case it serves to someone.
What I did to fix my problem was create a variable that contains the regex (the expression must be in quotes) and then call the variable to compare it to what the user enters.
My code:

Regexemail="/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)/";
        if (!(Regexemail.test(email))){
            mensajeError.push ("The email is not valid <br>");
        }