Hey all,

This is my first post on this site so forgive me if I make any formatting mistakes.

I'm trying to make a password validator that only allows passwords with at least one letter, at least one number, and at least one non-alphanumeric character. Here's what I'm using right now but I can't seem to match the non-alphanumeric character.

Code:
function ValidatePassword(password, password_c, msg)
{
	if (notEmpty(password, "Enter a password"))
	{
		if (password.value === password_c.value)
		{
			if (password.value.match("\W|_"))
			{
				if (/\d/.test(password.value) && /[a-zA-Z]/.test(password.value))
				{
					return true;
				} else {
					alert(msg);
				}
			} else {
				alert("Must have a special character in your password");
			}
		} else {
			alert("Passwords don't match");
		}
	}
	return false;
}
I got the regex codes from different sites so I'm guessing that's why they aren't working together. Any help is much appreciated!