I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
I don't think that's a particularly good answer, or something that can be generalised like that.
It presumes not only the things the asker is looking for - a number is 11 or 15 digits long and may or may not start with a + - but that the first digit isn't zero.
Most people in my country (UK) will enter their mobile number starting 07, because that's the most common prefix and 0 means "stand by telephone exchange because I'm about to hit you with a national number".
The trouble is, not all phones are mobile, not all mobiles have to start with a 7, people have redirected numbers in the same way they might have P.O. Boxes, and people may or may not want to use an internationalised number.
I guarantee any site using a regex (or expanded set of rules) like this one will have a small number of annoyed users who can't seem to put in their perfectly legitimate number.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I don't think that's a particularly good answer, or something that can be generalised like that.
It presumes not only the things the asker is looking for - a number is 11 or 15 digits long and may or may not start with a
+
- but that the first digit isn't zero.Most people in my country (UK) will enter their mobile number starting
07
, because that's the most common prefix and0
means "stand by telephone exchange because I'm about to hit you with a national number".The trouble is, not all phones are mobile, not all mobiles have to start with a
7
, people have redirected numbers in the same way they might have P.O. Boxes, and people may or may not want to use an internationalised number.I guarantee any site using a regex (or expanded set of rules) like this one will have a small number of annoyed users who can't seem to put in their perfectly legitimate number.