Twice recently I've hit the same problem with two different mobile phone vendor's websites. Vodafone (displayed here) and 3. When I type a phone number I split it into three sections using white-space. "nnnn nnn nnnn" that's how I remember numbers. That's not uncommon I don't think…
nor is it odd to use a dash.
So why do I need to learn how your website wants phone numbers formatted.
var correctedNumber = numberTypedOnForm.replace(" ","").replace("-","");
but it's about not introducing a pain point for customers when you don't have to
If you want to be really fancy you could
var correctedNumber = numberTypedOnForm.replace("/\D/g","");
Computers are supposed to make our lives easier but it's up to you website developers to help them help us.