1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file contains UTF8 strings that we want as char arrays. To avoid
6 // different compilers, we use a script to convert the UTF8 strings into
7 // numeric literals (\x##).
9 #include "components/autofill/core/browser/autofill_regex_constants.h"
13 /////////////////////////////////////////////////////////////////////////////
15 /////////////////////////////////////////////////////////////////////////////
16 const char kAttentionIgnoredRe[] = "attention|attn";
17 const char kRegionIgnoredRe[] =
18 "province|region|other"
20 "|bairro|suburb"; // pt-BR, pt-PT
21 const char kCompanyRe[] =
22 "company|business|organization|organisation"
23 "|firma|firmenname" // de-DE
25 "|societe|société" // fr-FR
26 "|ragione.?sociale" // it-IT
28 "|название.?компании" // ru
31 const char kAddressLine1Re[] =
32 "address.*line|address1|addr1|street"
33 "|strasse|straße|hausnummer|housenumber" // de-DE
34 "|house.?name" // en-GB
35 "|direccion|dirección" // es
39 "|morada|endereço" // pt-BR, pt-PT
43 const char kAddressLine1LabelRe[] =
50 const char kAddressLine2Re[] =
51 "address.*line2|address2|addr2|street|suite|unit"
52 "|adresszusatz|ergänzende.?angaben" // de-DE
53 "|direccion2|colonia|adicional" // es
54 "|addresssuppl|complementnom|appartement" // fr-FR
55 "|indirizzo2" // it-IT
57 "|complemento|addrcomplement" // pt-BR, pt-PT
61 const char kAddressLine2LabelRe[] =
67 const char kAddressLinesExtraRe[] =
68 "address.*line[3-9]|address[3-9]|addr[3-9]|street|line[3-9]"
70 "|batiment|residence" // fr-FR
71 "|indirizzo[3-9]"; // it-IT
72 const char kAddressLookupRe[] =
74 const char kCountryRe[] =
75 "country|countries|location"
80 const char kZipCodeRe[] =
81 "zip|postal|post.*code|pcode"
83 "|postleitzahl" // de-DE
88 "|codigo|codpos|\\bcep\\b" // pt-BR, pt-PT
89 "|Почтовый.?Индекс" // ru
93 const char kZip4Re[] =
95 "|codpos2"; // pt-BR, pt-PT
96 const char kCityRe[] =
98 "|\\bort\\b|stadt" // de-DE
100 "|ciudad|provincia|localidad|poblacion" // es
101 "|ville|commune" // fr-FR
104 "|cidade" // pt-BR, pt-PT
108 "|^시[^도·・]|시[·・]?군[·・]?구"; // ko-KR
109 const char kStateRe[] =
110 "(?<!united )state|county|region|province"
112 "|county|principality" // en-UK
114 "|estado|provincia" // pt-BR, pt-PT
118 "|^시[·・]?도"; // ko-KR
120 /////////////////////////////////////////////////////////////////////////////
121 // credit_card_field.cc
122 /////////////////////////////////////////////////////////////////////////////
123 const char kNameOnCardRe[] =
124 "card.?holder|name.*\\bon\\b.*card|(card|cc).?name|cc.?full.?name|owner"
125 "|karteninhaber" // de-DE
126 "|nombre.*tarjeta" // es
127 "|nom.*carte" // fr-FR
128 "|nome.*cart" // it-IT
131 "|信用卡开户名|开户名|持卡人姓名" // zh-CN
133 const char kNameOnCardContextualRe[] =
135 const char kCardNumberRe[] =
136 "(card|cc|acct).?(number|#|no|num)"
138 "|credito|numero|número" // es
141 "|Номер.*карты" // ru
142 "|信用卡号|信用卡号码" // zh-CN
145 const char kCardCvcRe[] =
146 "verification|card identification|security code|card code|cvn|cvv|cvc|csc"
148 const char kCardTypeRe[] =
149 "(card|cc|payment).?type|payment.?method";
151 // "Expiration date" is the most common label here, but some pages have
152 // "Expires", "exp. date" or "exp. month" and "exp. year". We also look
153 // for the field names ccmonth and ccyear, which appear on at least 4 of
156 // On at least one page (The China Shop2.html) we find only the labels
157 // "month" and "year". So for now we match these words directly; we'll
158 // see if this turns out to be too general.
160 // Toolbar Bug 51451: indeed, simply matching "month" is too general for
161 // https://rps.fidelity.com/ftgw/rps/RtlCust/CreatePIN/Init.
162 // Instead, we match only words beginning with "month".
163 const char kExpirationMonthRe[] =
164 "expir|exp.*mo|exp.*date|ccmonth|cardmonth"
165 "|gueltig|gültig|monat" // de-DE
167 "|date.*exp" // fr-FR
170 "|validade" // pt-BR, pt-PT
171 "|Срок действия карты" // ru
173 const char kExpirationYearRe[] =
175 "|ablaufdatum|gueltig|gültig|yahr" // de-DE
179 "|validade" // pt-BR, pt-PT
180 "|Срок действия карты" // ru
183 // This regex is a little bit nasty, but it is simply requiring exactly two
185 const char kExpirationDate2DigitYearRe[] =
186 "exp.*date.*[^y]yy([^y]|$)";
187 const char kExpirationDateRe[] =
189 "|gueltig|gültig" // de-DE
191 "|date.*exp" // fr-FR
194 "|validade" // pt-BR, pt-PT
195 "|Срок действия карты"; // ru
196 const char kCardIgnoredRe[] =
198 const char kGiftCardRe[] =
202 /////////////////////////////////////////////////////////////////////////////
204 /////////////////////////////////////////////////////////////////////////////
205 const char kEmailRe[] =
209 "|Электронной.?Почты" // ru
212 "|(이메일|전자.?우편|[Ee]-?mail)(.?주소)?"; // ko-KR
215 /////////////////////////////////////////////////////////////////////////////
217 /////////////////////////////////////////////////////////////////////////////
218 const char kNameIgnoredRe[] =
219 "user.?name|user.?id|nickname|maiden name|title|prefix|suffix"
220 "|vollständiger.?name" // de-DE
222 "|(사용자.?)?아이디|사용자.?ID"; // ko-KR
223 const char kNameRe[] =
224 "^name|full.?name|your.?name|customer.?name|firstandlastname|bill.?name"
226 "|nombre.*y.*apellidos" // es
229 "|^nome" // pt-BR, pt-PT
232 const char kNameSpecificRe[] =
235 "|^nome"; // pt-BR, pt-PT
236 const char kFirstNameRe[] =
237 "first.*name|initials|fname|first$"
240 "|forename|prénom|prenom" // fr-FR
242 "|nome" // pt-BR, pt-PT
245 const char kMiddleInitialRe[] = "middle.*initial|m\\.i\\.|mi$|\\bmi\\b";
246 const char kMiddleNameRe[] =
247 "middle.*name|mname|middle$"
248 "|apellido.?materno|lastlastname"; // es
249 const char kLastNameRe[] =
250 "last.*name|lname|surname|last$|secondname"
253 "|famille|^nom" // fr-FR
256 "|morada|apelidos|surename|sobrenome" // pt-BR, pt-PT
260 /////////////////////////////////////////////////////////////////////////////
262 /////////////////////////////////////////////////////////////////////////////
263 const char kPhoneRe[] =
265 "|telefonnummer" // de-DE
266 "|telefono|teléfono" // es
269 "|telefone|telemovel" // pt-BR, pt-PT
272 "|(전화|핸드폰|휴대폰|휴대전화)(.?번호)?"; // ko-KR
273 const char kCountryCodeRe[] =
274 "country.*code|ccode|_cc";
275 const char kAreaCodeNotextRe[] =
277 const char kAreaCodeRe[] =
278 "area.*code|acode|area"
280 const char kPhonePrefixSeparatorRe[] =
282 const char kPhoneSuffixSeparatorRe[] =
284 const char kPhonePrefixRe[] =
286 "|preselection" // fr-FR
287 "|ddd"; // pt-BR, pt-PT
288 const char kPhoneSuffixRe[] =
290 const char kPhoneExtensionRe[] =
291 "\\bext|ext\\b|extension"
292 "|ramal"; // pt-BR, pt-PT
294 } // namespace autofill