I want to allow only @ . and _ as special characters in email but it always shows errors
html code in php file:
//email
`echo "<td>email*</td><td><input type='text' id='regemail' name='regemail' onblur='javascript:valemail1()' onkeypress='javascript:hideemail()'></td>";`
`echo "</tr><tr id='emailerror'></tr>";`
javascript code(in function valemail1):
//regex
//if(!/^[a-zA-Z0-9]+$/.test(regemail)){
//document.getElementById('emailerror').innerHTML="<td><div id='redalert'>"+"only alphanumeric characters, an underscore (<b>_</b>), an (<b>@</b>) and a dot (<b>.</b>) are allowed in email"+"</div></td>";
//eemail=1;`
//return;`
//}else{
//}
//no error
if(eemail==0)
{
document.getElementById('emailerror').innerHTML="";
}
the function hideemail only hides error as
document.getElementById('emailerror').innerHTML="";
I actually dont know regex so please tell me what to type in it.