So I'm doing an assignment for class but since I transfered to this college with C++ experience rather than Java experience I'm having trouble keeping up with the syntax. We are supposed to make a form that a user enters Email, Phone Number, and Street address and then a javascript function uses regular expressions to validate if they are correct. If they aren't the program stay's in the form and popsup and error message saying what was wrong. But for me I can't seem t oget the .test method to work, or maybe my regex is wrong... I can't figure out what's going wrong!

<!DOCTYPE html>
<html>
<head>
<script>

function validate()
{
var emailPattern=/^[^0-9][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-Z]{2,4}$/;
var pNumberPattern=/\(?\d{3}\)?[-\s.]?\d{3}[-\s.]\d{4}/x;
var addressPattern=/[0-9]{1,}(\s[\w.]+)+/;

if (!pNumberPattern.test(pnumber) || !emailPattern.test(email) || !addressPattern.test(address))
{
if (!emailPattern.test(email))
{
alert("Not a valid Email Address");
}
else if (!pNumberPattern.test(pnumber))
{
alert("Not a valid Phone Number");
}
else if (!addressPattern.test(address))
{
alert("Not a valid Street Address");
}
return FALSE;
}
else
{
alert("Success");
return TRUE;
}
}

</script>
</head>

<body>

<center><table border=1 width=500px>
<th colspan="2"><center> My Form </center></th>

<form id="information" onsubmit="return validate();" method="post">
<tr>
<td>
<dir align="right"> User email: </dir>
</td>
<td>
<input type="text" name="email">
</td>
</tr>

<tr>
<td>
<dir align="right"> User Phone Number: </dir>
</td>
<td width =50%>
<p>
<input type="text" name="pnumber">
</p>
</td>
</tr>

<tr>
<td>
<dir align="right"> User Street address: </dir>
</td>
<td>
<input type="text" name="address">
</td>
</tr>


<td colspan="2"><center><input type="submit" value="Submit" /></center></td>
</form>

</table> </center>


</body>
</html>


Please help!