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 "|(shipping|billing)address$"
34 "|strasse|straße|hausnummer|housenumber" // de-DE
35 "|house.?name" // en-GB
36 "|direccion|dirección" // es
40 "|morada|endereço" // pt-BR, pt-PT
44 const char kAddressLine1LabelRe
[] =
51 const char kAddressLine2Re
[] =
52 "address.*line2|address2|addr2|street|suite|unit"
53 "|adresszusatz|ergänzende.?angaben" // de-DE
54 "|direccion2|colonia|adicional" // es
55 "|addresssuppl|complementnom|appartement" // fr-FR
56 "|indirizzo2" // it-IT
58 "|complemento|addrcomplement" // pt-BR, pt-PT
62 const char kAddressLine2LabelRe
[] =
68 const char kAddressLinesExtraRe
[] =
69 "address.*line[3-9]|address[3-9]|addr[3-9]|street|line[3-9]"
71 "|batiment|residence" // fr-FR
72 "|indirizzo[3-9]"; // it-IT
73 const char kAddressLookupRe
[] =
75 const char kCountryRe
[] =
81 const char kCountryLocationRe
[] =
83 const char kZipCodeRe
[] =
84 "zip|postal|post.*code|pcode"
86 "|postleitzahl" // de-DE
91 "|codigo|codpos|\\bcep\\b" // pt-BR, pt-PT
92 "|Почтовый.?Индекс" // ru
96 const char kZip4Re
[] =
98 "|codpos2"; // pt-BR, pt-PT
99 const char kCityRe
[] =
101 "|\\bort\\b|stadt" // de-DE
103 "|ciudad|provincia|localidad|poblacion" // es
104 "|ville|commune" // fr-FR
107 "|cidade" // pt-BR, pt-PT
111 "|^시[^도·・]|시[·・]?군[·・]?구"; // ko-KR
112 const char kStateRe
[] =
113 "(?<!united )state|county|region|province"
115 "|county|principality" // en-UK
117 "|estado|provincia" // pt-BR, pt-PT
121 "|^시[·・]?도"; // ko-KR
123 /////////////////////////////////////////////////////////////////////////////
124 // credit_card_field.cc
125 /////////////////////////////////////////////////////////////////////////////
126 const char kNameOnCardRe
[] =
127 "card.?(holder|owner)|name.*\\bon\\b.*card|(card|cc).?name|cc.?full.?name"
128 "|karteninhaber" // de-DE
129 "|nombre.*tarjeta" // es
130 "|nom.*carte" // fr-FR
131 "|nome.*cart" // it-IT
134 "|信用卡开户名|开户名|持卡人姓名" // zh-CN
136 const char kNameOnCardContextualRe
[] =
138 const char kCardNumberRe
[] =
139 "(card|cc|acct).?(number|#|no|num)"
141 "|credito|numero|número" // es
144 "|Номер.*карты" // ru
145 "|信用卡号|信用卡号码" // zh-CN
148 const char kCardCvcRe
[] =
149 "verification|card identification|security code|card code"
150 "|cvn|cvv|cvc|csc|cvd|cid|ccv"
153 // "Expiration date" is the most common label here, but some pages have
154 // "Expires", "exp. date" or "exp. month" and "exp. year". We also look
155 // for the field names ccmonth and ccyear, which appear on at least 4 of
158 // On at least one page (The China Shop2.html) we find only the labels
159 // "month" and "year". So for now we match these words directly; we'll
160 // see if this turns out to be too general.
162 // Toolbar Bug 51451: indeed, simply matching "month" is too general for
163 // https://rps.fidelity.com/ftgw/rps/RtlCust/CreatePIN/Init.
164 // Instead, we match only words beginning with "month".
165 const char kExpirationMonthRe
[] =
166 "expir|exp.*mo|exp.*date|ccmonth|cardmonth"
167 "|gueltig|gültig|monat" // de-DE
169 "|date.*exp" // fr-FR
172 "|validade" // pt-BR, pt-PT
173 "|Срок действия карты" // ru
175 const char kExpirationYearRe
[] =
177 "|ablaufdatum|gueltig|gültig|yahr" // de-DE
181 "|validade" // pt-BR, pt-PT
182 "|Срок действия карты" // ru
185 // The "yy" portion of the regex is just looking for two adjacent y's.
186 const char kExpirationDate2DigitYearRe
[] =
187 "(exp.*date.*|mm\\s*[-/]\\s*)[^y]yy([^y]|$)";
188 const char kExpirationDate4DigitYearRe
[] =
189 "^mm\\s*[-/]\\syyyy$";
190 const char kExpirationDateRe
[] =
192 "|gueltig|gültig" // de-DE
194 "|date.*exp" // fr-FR
197 "|validade" // pt-BR, pt-PT
198 "|Срок действия карты"; // ru
199 const char kGiftCardRe
[] =
201 const char kDebitGiftCardRe
[] =
202 "(visa|mastercard|discover|amex|american express).*gift.?card";
203 const char kDebitCardRe
[] =
207 /////////////////////////////////////////////////////////////////////////////
209 /////////////////////////////////////////////////////////////////////////////
210 const char kEmailRe
[] =
214 "|Электронной.?Почты" // ru
217 "|(이메일|전자.?우편|[Ee]-?mail)(.?주소)?"; // ko-KR
220 /////////////////////////////////////////////////////////////////////////////
222 /////////////////////////////////////////////////////////////////////////////
223 const char kNameIgnoredRe
[] =
224 "user.?name|user.?id|nickname|maiden name|title|prefix|suffix"
225 "|vollständiger.?name" // de-DE
227 "|(사용자.?)?아이디|사용자.?ID"; // ko-KR
228 const char kNameRe
[] =
229 "^name|full.?name|your.?name|customer.?name|bill.?name|ship.?name"
230 "|name.*first.*last|firstandlastname"
231 "|nombre.*y.*apellidos" // es
234 "|^nome" // pt-BR, pt-PT
237 const char kNameSpecificRe
[] =
240 "|^nome"; // pt-BR, pt-PT
241 const char kFirstNameRe
[] =
242 "first.*name|initials|fname|first$|given.*name"
245 "|forename|prénom|prenom" // fr-FR
247 "|nome" // pt-BR, pt-PT
250 const char kMiddleInitialRe
[] = "middle.*initial|m\\.i\\.|mi$|\\bmi\\b";
251 const char kMiddleNameRe
[] =
252 "middle.*name|mname|middle$"
253 "|apellido.?materno|lastlastname"; // es
254 const char kLastNameRe
[] =
255 "last.*name|lname|surname|last$|secondname|family.*name"
258 "|famille|^nom" // fr-FR
261 "|morada|apelidos|surename|sobrenome" // pt-BR, pt-PT
265 /////////////////////////////////////////////////////////////////////////////
267 /////////////////////////////////////////////////////////////////////////////
268 const char kPhoneRe
[] =
270 "|telefonnummer" // de-DE
271 "|telefono|teléfono" // es
274 "|telefone|telemovel" // pt-BR, pt-PT
277 "|(전화|핸드폰|휴대폰|휴대전화)(.?번호)?"; // ko-KR
278 const char kCountryCodeRe
[] =
279 "country.*code|ccode|_cc";
280 const char kAreaCodeNotextRe
[] =
282 const char kAreaCodeRe
[] =
283 "area.*code|acode|area"
285 const char kPhonePrefixSeparatorRe
[] =
287 const char kPhoneSuffixSeparatorRe
[] =
289 const char kPhonePrefixRe
[] =
291 "|preselection" // fr-FR
292 "|ddd"; // pt-BR, pt-PT
293 const char kPhoneSuffixRe
[] =
295 const char kPhoneExtensionRe
[] =
296 "\\bext|ext\\b|extension"
297 "|ramal"; // pt-BR, pt-PT
299 } // namespace autofill