Changes between Version 11 and Version 12 of Rules/UkrainePhoneNumbers


Ignore:
Timestamp:
2022-05-27T20:29:46+02:00 (3 years ago)
Author:
andygol
Comment:

Added rules for PrivatBank short number; fixed bug with emergency phones

Legend:

Unmodified
Added
Removed
Modified
  • Rules/UkrainePhoneNumbers

    v11 v12  
    88Toll-free phones `0 800 ххх ххх` must be specified without a country code, the `phone:UA` key is used to record them.
    99
    10 Use `emergency:phone=*` tag to add emergency numbers.
     10Use `emergency:phone=*` tag for adding emergency numbers.
    1111- 112 - general emergency number, one for all services
    1212- 101 - firefighters
     
    1515- 104 - gas service
    1616- 109 - information desk
     17
     18Use `contact:phone=*` tag for adding short service numbers. So far, the rules for checking the short number of PrivatBank (3700).
    1719
    1820{{{
     
    3436}
    3537
    36 *[/^(contact:)?(phone|fax)(?!:UA)$/][/^(contact:)?(phone|fax)(?!:UA)$/ !~ /^((;?(?=(\+\b380 [3-9][0-9][0-9 ]{9}\b)|(0 800 \d{3} \d{3}))(?=.*((0 800 \d{3} \d{3})|(\+\b380 (?:\d{2} \d{3} \d{4}|\d{3} \d{2} \d{4}|\d{4} \d{2} \d{3})\b)))((0 800 \d{3} \d{3})|(\+\b380 (?:\d{2} \d{3} \d{4}|\d{3} \d{2} \d{4}|\d{4} \d{2} \d{3})\b)))*)$/][inside("UA")] {
     38*[/^(contact:)?(phone|fax)(?!:UA)$/][/^(contact:)?(phone|fax)(?!:UA)$/ !~ /^((;?(?=(\+\b380 [3-9][0-9][0-9 ]{9}\b)|(0 800 \d{3} \d{3})|(3700))(?=.*(\b(3700)\b|\b(0 800 \d{3} \d{3})\b|(\+\b380 (?:\d{2} \d{3} \d{4}|\d{3} \d{2} \d{4}|\d{4} \d{2} \d{3})\b)))(\b(3700)\b|\b(0 800 \d{3} \d{3})\b|(\+\b380 (?:\d{2} \d{3} \d{4}|\d{3} \d{2} \d{4}|\d{4} \d{2} \d{3})\b)))*)$/][inside("UA")] {
    3739    throwWarning: tr("{0}", "{0.tag}");
    3840    group: tr("Incorrect \"phone\" tag");
     
    4244}
    4345
    44 *["phone" =~ /^(;?(0 800 \d{3} \d{3}))*$/][inside("UA")] {
     46*["phone" =~ /^(;?(0 800 \d{3} \d{3}))*$/][inside("UA")],
     47*["contact:phone" =~ /^(;?(0 800 \d{3} \d{3}))*$/][inside("UA")] {
    4548    throwError: tr("{0}", "");
    4649    group: tr("A toll-free phone number is listed in the \"phone\" tag");
    47     fixChangeKey: "phone=>phone:UA";
     50    fixChangeKey: "{0.key}=>phone:UA";
    4851    assertMatch: "node phone=0 800 500 609";
    4952    assertMatch: "way phone=0 800 500 609";
     
    6871}
    6972
    70 *[/^(contact:)?(phone|fax)(?!:UA)$/ =~ /^.*(;?(?=\b(112|10[1-49])\b)(112|10[1-49])*)(?<=(112|10[1-49])).*$/][inside("UA")] {
     73/*+380 3333 00 102 - fixed. Here, 102 is a part of the number, not an emergency phone by itself*/
     74*[/^(contact:)?(phone|fax)(?!:UA)$/][/^(contact:)?(phone|fax)(?!:UA)$/ =~ /;?(?=\b(112|10[1-49])\b)(?<! )(112|10[1-49])*/][inside("UA")] {
    7175    throwWarning: tr("Emergency phone number is in the \"phone\" tag");
    7276    suggestAlternative: tr("\"emergency:phone=*\"");
    7377}
    7478
    75 *[/(phone|fax)/ =~ /; *$/][inside("UA")] {
     79*[/(phone|fax)/ =~ /\d; *$/][inside("UA")] {
    7680    throwWarning: tr("{0}", "");
    77     group: tr("Empty value after \";\" at the end of the tag");
     81    group: tr("Empty value after \";\" at the end of the phone/fax tag");
     82}
     83
     84/* privatbank short number - not tested yet */
     85*["phone" =~ /\b3700\b/][/^name(:\w\w)?$/ =~ /^(?i)(?u)(ПриватБанк)$/][inside("UA")] {
     86    throwError: tr("{0}", "");
     87    group: tr("Privatbank short number is listed in the \"phone\" tag");
     88    suggestAlternative: tr("contact:phone = 3700 for short number");
    7889}
    7990}}}