Actually not. The 0 has been dropped from the phone numbers some years ago. The original scheme was 4 to 8 numbers not starting with 0 for a local number (different districts had different number of phones and thus different number length) or 0 area_code local_number. 02 used to mean Prague. They increased the number of digits as necessary and made the area code required and thus the 0 unnecessary. So 02 12 34 56 78 became 212 345 678.

Regarding +420 (0)2 ... the original country code was 42 so the numbers were +42 0 area_code local_number. After we split with the slovaks our code was "changed" to 420, they were assigned 421. So the international numbers became +420 area_code local_number. In either case +420 02/xx xx xx xx would have one too many zeroes I believe. (Sorry for this lengthy and largely pointless post.)

In either case I think this is a bit too tricky task. Especially if you wanted them to accept the special numbers. 911 in US, 112,150,155,158 and probably a few others in Czech Rep and quite a few more in other countries. I think it's best not to be too strict while validating phone numbers. At least unless you can restrict them to a single country.


In reply to Re^2: Simple but thought-provoking programming tasks [OT] by Jenda
in thread Simple but thought-provoking programming tasks [OT] by Cody Pendant

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.