I have been looking to validate a number with formatting, it could look like any of these:

+44 0100 123456

or combinations of the above, so what I was trying to allow in the string was:

'0-9' ' ' '-' '+'

because this number could from any number of different countries, I can't specify a tight format so what I was trying to do was this:

//to check that values have been entered for Telephone or email address
if((telVal.length >= 6) || (emailVal.length >= 9))
alert("either a telephone number or an email address has been entered");
if (telVal >= 6)
var invalidTelExp = /[^0-9\ \+\-]/i;
var invalidTel = (invalidTelExp.test(telVal));
//now need to give the relevant message
if(invalidTel == true)
alert("You have entereda telephone number but it contains invalid characters");
alert("a valid telephone number has been added");

the bold bit being the important part, some of the alerts are just in there for testing. I have tried using:

/[^0-9\ \+\-]/i
/[^0-9 +-]/i;

neither of which seem to work correctly. Can anyone see what I am doing wrong?

strictly speaking it should allow a '+' if it is at the beginning of the string and spaces or hyphens where people have used them to break the number up.

Thank-you in advance for your help