Changes between Version 10 and Version 11 of Rules/UkrainePhoneNumbers


Ignore:
Timestamp:
2022-05-24T19:53:17+02:00 (3 years ago)
Author:
andygol
Comment:

Toll-free phones

Legend:

Unmodified
Added
Removed
Modified
  • Rules/UkrainePhoneNumbers

    v10 v11  
    3535
    3636*[/^(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")] {
    37     throwWarning: tr("Incorrect \"phone\" tag");
     37    throwWarning: tr("{0}", "{0.tag}");
     38    group: tr("Incorrect \"phone\" tag");
    3839    suggestAlternative: tr("format +380⎵44⎵123⎵4567;+380⎵352⎵12⎵3456;+380⎵5345⎵12⎵345");
    3940    assertMatch: "node phone=+380 44 366 7002";
     
    4142}
    4243
    43 *[/^phone$/ =~ /^(;?(0 800 \d{3} \d{3}))*$/][inside("UA")] {
     44*["phone" =~ /^(;?(0 800 \d{3} \d{3}))*$/][inside("UA")] {
    4445    throwError: tr("{0}", "");
    4546    group: tr("A toll-free phone number is listed in the \"phone\" tag");
     
    4748    assertMatch: "node phone=0 800 500 609";
    4849    assertMatch: "way phone=0 800 500 609";
    49     assertNoMatch: "node phone:UA=0 800 500 609";
    50     assertNoMatch: "way phone:UA=0 800 500 609";
     50    assertNoMatch: "node phone:UA=0800 500 609";
     51    assertNoMatch: "way phone:UA=0800 500 609";
    5152}
    5253
    53 *["emergency:phone"]["emergency:phone" !~ /^(;?(?=(112|10[1-49]))(?=.*(112|10[1-49]))(112|10[1-49]))*$/] {
     54*[/^(contact:)?(phone|fax)(?!:UA)$/][/^(contact:)?(phone|fax)(?!:UA)$/ =~ /800(([ -]\d{3}){2}|([ -]\d{2}){3})/][inside("UA")] {
     55    throwWarning: tr("{0}", "{0.tag}");
     56    group: tr("Toll-free number among other phones");
     57    suggestAlternative: tr("ex. phone:UA=0⎵800⎵300⎵545");
     58}
     59
     60*["phone:UA"]["phone:UA" !~ /^(;?(0 800 \d{3} \d{3}))*$/][inside("UA")] {
     61    throwWarning: tr("{0}", "{0.tag}");
     62    group: tr("Incorrect format of the toll-free number");
     63    suggestAlternative: tr("ex. phone:UA=0⎵800⎵300⎵545");
     64}
     65
     66*["emergency:phone"]["emergency:phone" !~ /^(;?(?=(112|10[1-49]))(?=.*(112|10[1-49]))(112|10[1-49]))*$/][inside("UA")] {
    5467    throwWarning: tr("({0}). \"emergency:phone=*\" value must be one of 112, 101, 102, 103, 104, 109", "{0.tag}");
    5568}
    5669
    57 *[/^(contact:)?(phone|fax)(?!:UA)$/ =~ /^.*(;?(?=\b(112|10[1-49])\b)(112|10[1-49])*)(?<=(112|10[1-49])).*$/] {
     70*[/^(contact:)?(phone|fax)(?!:UA)$/ =~ /^.*(;?(?=\b(112|10[1-49])\b)(112|10[1-49])*)(?<=(112|10[1-49])).*$/][inside("UA")] {
    5871    throwWarning: tr("Emergency phone number is in the \"phone\" tag");
    5972    suggestAlternative: tr("\"emergency:phone=*\"");
    6073}
     74
     75*[/(phone|fax)/ =~ /; *$/][inside("UA")] {
     76    throwWarning: tr("{0}", "");
     77    group: tr("Empty value after \";\" at the end of the tag");
     78}
    6179}}}