/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * Form Autofill field Heuristics RegExp. */ /* exported HeuristicsRegExp */ "use strict"; var HeuristicsRegExp = { // These regular expressions are from Chromium source codes [1]. Most of them // converted to JS format have the same meaning with the original ones except // the first line of "address-level1". // [1] https://cs.chromium.org/chromium/src/components/autofill/core/browser/autofill_regex_constants.cc RULES: { // ==== Email ==== "email": new RegExp( "e.?mail" + "|courriel" + // fr "|メールアドレス" + // ja-JP "|Электронной.?Почты" + // ru "|邮件|邮箱" + // zh-CN "|電郵地址" + // zh-TW "|(?:이메일|전자.?우편|[Ee]-?mail)(.?주소)?", // ko-KR "iu" ), // ==== Telephone ==== "tel-extension": new RegExp( "\\bext|ext\\b|extension" + "|ramal", // pt-BR, pt-PT "iu" ), "tel": new RegExp( "phone|mobile|contact.?number" + "|telefonnummer" + // de-DE "|telefono|teléfono" + // es "|telfixe" + // fr-FR "|電話" + // ja-JP "|telefone|telemovel" + // pt-BR, pt-PT "|телефон" + // ru "|电话" + // zh-CN "|(?:전화|핸드폰|휴대폰|휴대전화)(?:.?번호)?", // ko-KR "iu" ), // ==== Address Fields ==== "organization": new RegExp( "company|business|organization|organisation" + "|firma|firmenname" + // de-DE "|empresa" + // es "|societe|société" + // fr-FR "|ragione.?sociale" + // it-IT "|会社" + // ja-JP "|название.?компании" + // ru "|单位|公司" + // zh-CN "|회사|직장", // ko-KR "iu" ), "street-address": new RegExp( "streetaddress|street-address", "iu" ), "address-line1": new RegExp( "^address$|address[_-]?line(one)?|address1|addr1|street" + "|(?:shipping|billing)address$" + "|strasse|straße|hausnummer|housenumber" + // de-DE "|house.?name" + // en-GB "|direccion|dirección" + // es "|adresse" + // fr-FR "|indirizzo" + // it-IT "|^住所$|住所1" + // ja-JP "|morada|endereço" + // pt-BR, pt-PT "|Адрес" + // ru "|地址" + // zh-CN "|^주소.?$|주소.?1", // ko-KR "iu" ), "address-line2": new RegExp( "address[_-]?line(2|two)|address2|addr2|street|suite|unit" + "|adresszusatz|ergänzende.?angaben" + // de-DE "|direccion2|colonia|adicional" + // es "|addresssuppl|complementnom|appartement" + // fr-FR "|indirizzo2" + // it-IT "|住所2" + // ja-JP "|complemento|addrcomplement" + // pt-BR, pt-PT "|Улица" + // ru "|地址2" + // zh-CN "|주소.?2", // ko-KR "iu" ), "address-line3": new RegExp( "address[_-]?line(3|three)|address3|addr3|street|suite|unit" + "|adresszusatz|ergänzende.?angaben" + // de-DE "|direccion3|colonia|adicional" + // es "|addresssuppl|complementnom|appartement" + // fr-FR "|indirizzo3" + // it-IT "|住所3" + // ja-JP "|complemento|addrcomplement" + // pt-BR, pt-PT "|Улица" + // ru "|地址3" + // zh-CN "|주소.?3", // ko-KR "iu" ), "address-level2": new RegExp( "city|town" + "|\\bort\\b|stadt" + // de-DE "|suburb" + // en-AU "|ciudad|provincia|localidad|poblacion" + // es "|ville|commune" + // fr-FR "|localita" + // it-IT "|市区町村" + // ja-JP "|cidade" + // pt-BR, pt-PT "|Город" + // ru "|市" + // zh-CN "|分區" + // zh-TW "|^시[^도·・]|시[·・]?군[·・]?구", // ko-KR "iu" ), "address-level1": new RegExp( // JS does not support backward matching, so the following pattern is // applied in FormAutofillHeuristics.getInfo() rather than regexp. // "(?