Apologies, this is the actual code I'm using. Field names are different, both fields are in form "ff".
if (document.ff.ref1email.value != "")
{
var str = new String(document.ff.ref1email.value);
var isOK = true;
rExp = /[!\"£$%\^&*()-+=<>,\'#?\\|¬`\/\[\]]/
if(...