I have been attempting to validate an australian phone number using javascript however it has been accepting everything. It needs to be 10 numbers long beginning with 0 accepting spaces:
02 4345 2334
and together
0243452334.
I think the regex might be wrong or the code itself
function PhoneNumberVal(form){
    var phoneFormat= /^0[0-8]{2})\)?[ ]?([0-9]{4})[ ]?([0-9]{4})$/;  
    var phoneLength = document.getElementById('phone').value.length;
    if(phoneFormat.test(phoneLength)) {
        return true;
    } else {
        alert("Not a valid phone number");
        return false;
    }
}