diff --git a/cpp/src/phonenumbers/phonenumbermatcher.cc b/cpp/src/phonenumbers/phonenumbermatcher.cc index adcc384e3..a3ebbd15b 100644 --- a/cpp/src/phonenumbers/phonenumbermatcher.cc +++ b/cpp/src/phonenumbers/phonenumbermatcher.cc @@ -482,35 +482,6 @@ bool PhoneNumberMatcher::ParseAndVerify(const string& candidate, int offset, return false; } - - // Check Israel * numbers: these are a special case in that they are - // four-digit numbers that our library supports, but they can only be dialled - // with a leading *. Since we don't actually store or detect the * in our - // phone number library, this means in practice we detect most four digit - // numbers as being valid for Israel. We are considering moving these numbers - // to ShortNumberInfo instead, in which case this problem would go away, but - // in the meantime we want to restrict the false matches so we only allow - // these numbers if they are preceded by a star. We enforce this for all - // leniency levels even though these numbers are technically accepted by - // isPossibleNumber and isValidNumber since we consider it to be a deficiency - // in those methods that they accept these numbers without the *. - // TODO: Remove this or make it significantly less hacky once - // we've decided how to handle these short codes going forward in - // ShortNumberInfo. We could use the formatting rules for instance, but that - // would be slower. - string region_code; - phone_util_.GetRegionCodeForCountryCode(number.country_code(), ®ion_code); - if (region_code == "IL") { - string national_number; - phone_util_.GetNationalSignificantNumber(number, &national_number); - if (national_number.length() == 4 && - // Just check the previous char, since * is an ASCII character. - (offset == 0 || (offset > 0 && text_[offset - 1] != '*'))) { - // No match. - return false; - } - } - if (VerifyAccordingToLeniency(leniency_, number, candidate)) { match->set_start(offset); match->set_raw_string(candidate); diff --git a/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberMatcher.java b/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberMatcher.java index 8310fe3c1..3a6e3a687 100644 --- a/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberMatcher.java +++ b/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberMatcher.java @@ -413,25 +413,6 @@ final class PhoneNumberMatcher implements Iterator { PhoneNumber number = phoneUtil.parseAndKeepRawInput(candidate, preferredRegion); - // Check Israel * numbers: these are a special case in that they are four-digit numbers that - // our library supports, but they can only be dialled with a leading *. Since we don't - // actually store or detect the * in our phone number library, this means in practice we - // detect most four digit numbers as being valid for Israel. We are considering moving these - // numbers to ShortNumberInfo instead, in which case this problem would go away, but in the - // meantime we want to restrict the false matches so we only allow these numbers if they are - // preceded by a star. We enforce this for all leniency levels even though these numbers are - // technically accepted by isPossibleNumber and isValidNumber since we consider it to be a - // deficiency in those methods that they accept these numbers without the *. - // TODO: Remove this or make it significantly less hacky once we've decided how to - // handle these short codes going forward in ShortNumberInfo. We could use the formatting - // rules for instance, but that would be slower. - if (phoneUtil.getRegionCodeForCountryCode(number.getCountryCode()).equals("IL") - && phoneUtil.getNationalSignificantNumber(number).length() == 4 - && (offset == 0 || (offset > 0 && text.charAt(offset - 1) != '*'))) { - // No match. - return null; - } - if (leniency.verify(number, candidate, phoneUtil)) { // We used parseAndKeepRawInput to create this number, but for now we don't return the extra // values parsed. TODO: stop clearing all values here and switch all users over