Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: components/autofill/core/browser/autofill_regex_constants.cc

Issue 2877473002: Move autofill_regex_constants to core/common. (Closed)
Patch Set: Remove illegal dependency. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
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##).
8
9 #include "components/autofill/core/browser/autofill_regex_constants.h"
10
11 namespace autofill {
12
13 /////////////////////////////////////////////////////////////////////////////
14 // address_field.cc
15 /////////////////////////////////////////////////////////////////////////////
16 const char kAttentionIgnoredRe[] = "attention|attn";
17 const char kRegionIgnoredRe[] =
18 "province|region|other"
19 "|provincia" // es
20 "|bairro|suburb"; // pt-BR, pt-PT
21 const char kAddressNameIgnoredRe[] = "address.*nickname|address.*label";
22 const char kCompanyRe[] =
23 "company|business|organization|organisation"
24 "|firma|firmenname" // de-DE
25 "|empresa" // es
26 "|societe|société" // fr-FR
27 "|ragione.?sociale" // it-IT
28 "|会社" // ja-JP
29 "|название.?компании" // ru
30 "|单位|公司" // zh-CN
31 "|회사|직장"; // ko-KR
32 const char kAddressLine1Re[] =
33 "^address$|address[_-]?line(one)?|address1|addr1|street"
34 "|(?:shipping|billing)address$"
35 "|strasse|straße|hausnummer|housenumber" // de-DE
36 "|house.?name" // en-GB
37 "|direccion|dirección" // es
38 "|adresse" // fr-FR
39 "|indirizzo" // it-IT
40 "|^住所$|住所1" // ja-JP
41 "|morada|endereço" // pt-BR, pt-PT
42 "|Адрес" // ru
43 "|地址" // zh-CN
44 "|^주소.?$|주소.?1"; // ko-KR
45 const char kAddressLine1LabelRe[] =
46 "address"
47 "|adresse" // fr-FR
48 "|indirizzo" // it-IT
49 "|住所" // ja-JP
50 "|地址" // zh-CN
51 "|주소"; // ko-KR
52 const char kAddressLine2Re[] =
53 "address[_-]?line(2|two)|address2|addr2|street|suite|unit"
54 "|adresszusatz|ergänzende.?angaben" // de-DE
55 "|direccion2|colonia|adicional" // es
56 "|addresssuppl|complementnom|appartement" // fr-FR
57 "|indirizzo2" // it-IT
58 "|住所2" // ja-JP
59 "|complemento|addrcomplement" // pt-BR, pt-PT
60 "|Улица" // ru
61 "|地址2" // zh-CN
62 "|주소.?2"; // ko-KR
63 const char kAddressLine2LabelRe[] =
64 "address|line"
65 "|adresse" // fr-FR
66 "|indirizzo" // it-IT
67 "|地址" // zh-CN
68 "|주소"; // ko-KR
69 const char kAddressLinesExtraRe[] =
70 "address.*line[3-9]|address[3-9]|addr[3-9]|street|line[3-9]"
71 "|municipio" // es
72 "|batiment|residence" // fr-FR
73 "|indirizzo[3-9]"; // it-IT
74 const char kAddressLookupRe[] =
75 "lookup";
76 const char kCountryRe[] =
77 "country|countries"
78 "|país|pais" // es
79 "|国" // ja-JP
80 "|国家" // zh-CN
81 "|국가|나라"; // ko-KR
82 const char kCountryLocationRe[] =
83 "location";
84 const char kZipCodeRe[] =
85 "zip|postal|post.*code|pcode"
86 "|pin.?code" // en-IN
87 "|postleitzahl" // de-DE
88 "|\\bcp\\b" // es
89 "|\\bcdp\\b" // fr-FR
90 "|\\bcap\\b" // it-IT
91 "|郵便番号" // ja-JP
92 "|codigo|codpos|\\bcep\\b" // pt-BR, pt-PT
93 "|Почтовый.?Индекс" // ru
94 "|邮政编码|邮编" // zh-CN
95 "|郵遞區號" // zh-TW
96 "|우편.?번호"; // ko-KR
97 const char kZip4Re[] =
98 "zip|^-$|post2"
99 "|codpos2"; // pt-BR, pt-PT
100 const char kCityRe[] =
101 "city|town"
102 "|\\bort\\b|stadt" // de-DE
103 "|suburb" // en-AU
104 "|ciudad|provincia|localidad|poblacion" // es
105 "|ville|commune" // fr-FR
106 "|localita" // it-IT
107 "|市区町村" // ja-JP
108 "|cidade" // pt-BR, pt-PT
109 "|Город" // ru
110 "|市" // zh-CN
111 "|分區" // zh-TW
112 "|^시[^도·・]|시[·・]?군[·・]?구"; // ko-KR
113 const char kStateRe[] =
114 "(?<!united )state|county|region|province"
115 "|land" // de-DE
116 "|county|principality" // en-UK
117 "|都道府県" // ja-JP
118 "|estado|provincia" // pt-BR, pt-PT
119 "|область" // ru
120 "|省" // zh-CN
121 "|地區" // zh-TW
122 "|^시[·・]?도"; // ko-KR
123
124 /////////////////////////////////////////////////////////////////////////////
125 // credit_card_field.cc
126 /////////////////////////////////////////////////////////////////////////////
127 const char kNameOnCardRe[] =
128 "card.?(?:holder|owner)|name.*(\\b)?on(\\b)?.*card"
129 "|(?:card|cc).?name|cc.?full.?name"
130 "|karteninhaber" // de-DE
131 "|nombre.*tarjeta" // es
132 "|nom.*carte" // fr-FR
133 "|nome.*cart" // it-IT
134 "|名前" // ja-JP
135 "|Имя.*карты" // ru
136 "|信用卡开户名|开户名|持卡人姓名" // zh-CN
137 "|持卡人姓名"; // zh-TW
138 const char kNameOnCardContextualRe[] =
139 "name";
140 const char kCardNumberRe[] =
141 "(add)?(?:card|cc|acct).?(?:number|#|no|num|field)"
142 "|nummer" // de-DE
143 "|credito|numero|número" // es
144 "|numéro" // fr-FR
145 "|カード番号" // ja-JP
146 "|Номер.*карты" // ru
147 "|信用卡号|信用卡号码" // zh-CN
148 "|信用卡卡號" // zh-TW
149 "|카드"; // ko-KR
150 const char kCardCvcRe[] =
151 "verification|card.?identification|security.?code|card.?code"
152 "|security.?number|card.?pin|c-v-v"
153 "|(cvn|cvv|cvc|csc|cvd|cid|ccv)(field)?"
154 "|\\bcid\\b";
155
156 // "Expiration date" is the most common label here, but some pages have
157 // "Expires", "exp. date" or "exp. month" and "exp. year". We also look
158 // for the field names ccmonth and ccyear, which appear on at least 4 of
159 // our test pages.
160
161 // On at least one page (The China Shop2.html) we find only the labels
162 // "month" and "year". So for now we match these words directly; we'll
163 // see if this turns out to be too general.
164
165 // Toolbar Bug 51451: indeed, simply matching "month" is too general for
166 // https://rps.fidelity.com/ftgw/rps/RtlCust/CreatePIN/Init.
167 // Instead, we match only words beginning with "month".
168 const char kExpirationMonthRe[] =
169 "expir|exp.*mo|exp.*date|ccmonth|cardmonth|addmonth"
170 "|gueltig|gültig|monat" // de-DE
171 "|fecha" // es
172 "|date.*exp" // fr-FR
173 "|scadenza" // it-IT
174 "|有効期限" // ja-JP
175 "|validade" // pt-BR, pt-PT
176 "|Срок действия карты" // ru
177 "|月"; // zh-CN
178 const char kExpirationYearRe[] =
179 "exp|^/|(add)?year"
180 "|ablaufdatum|gueltig|gültig|jahr" // de-DE
181 "|fecha" // es
182 "|scadenza" // it-IT
183 "|有効期限" // ja-JP
184 "|validade" // pt-BR, pt-PT
185 "|Срок действия карты" // ru
186 "|年|有效期"; // zh-CN
187
188 // Used to match a expiration date field with a two digit year.
189 // The following conditions must be met:
190 // - Exactly two adjacent y's.
191 // - (optional) Exactly two adjacent m's before the y's.
192 // - (optional) Separated by white-space and/or a dash or slash.
193 // - (optional) Prepended with some text similar to "Expiration Date".
194 // Tested in components/autofill/core/common/autofill_regexes_unittest.cc
195 const char kExpirationDate2DigitYearRe[] =
196 "(?:exp.*date[^y\\n\\r]*|mm\\s*[-/]?\\s*)yy(?:[^y]|$)";
197 // Used to match a expiration date field with a four digit year.
198 // Same requirements as |kExpirationDate2DigitYearRe| except:
199 // - Exactly four adjacent y's.
200 // Tested in components/autofill/core/common/autofill_regexes_unittest.cc
201 const char kExpirationDate4DigitYearRe[] =
202 "(?:exp.*date[^y\\n\\r]*|mm\\s*[-/]?\\s*)yyyy(?:[^y]|$)";
203 // Used to match expiration date fields that do not specify a year length.
204 const char kExpirationDateRe[] =
205 "expir|exp.*date|^expfield$"
206 "|gueltig|gültig" // de-DE
207 "|fecha" // es
208 "|date.*exp" // fr-FR
209 "|scadenza" // it-IT
210 "|有効期限" // ja-JP
211 "|validade" // pt-BR, pt-PT
212 "|Срок действия карты"; // ru
213 const char kGiftCardRe[] =
214 "gift.?card";
215 const char kDebitGiftCardRe[] =
216 "(?:visa|mastercard|discover|amex|american express).*gift.?card";
217 const char kDebitCardRe[] =
218 "debit.*card";
219
220
221 /////////////////////////////////////////////////////////////////////////////
222 // email_field.cc
223 /////////////////////////////////////////////////////////////////////////////
224 const char kEmailRe[] =
225 "e.?mail"
226 "|courriel" // fr
227 "|メールアドレス" // ja-JP
228 "|Электронной.?Почты" // ru
229 "|邮件|邮箱" // zh-CN
230 "|電郵地址" // zh-TW
231 "|(?:이메일|전자.?우편|[Ee]-?mail)(.?주소)?"; // ko-KR
232
233
234 /////////////////////////////////////////////////////////////////////////////
235 // name_field.cc
236 /////////////////////////////////////////////////////////////////////////////
237 const char kNameIgnoredRe[] =
238 "user.?name|user.?id|nickname|maiden name|title|prefix|suffix"
239 "|vollständiger.?name" // de-DE
240 "|用户名" // zh-CN
241 "|(?:사용자.?)?아이디|사용자.?ID"; // ko-KR
242 const char kNameRe[] =
243 "^name|full.?name|your.?name|customer.?name|bill.?name|ship.?name"
244 "|name.*first.*last|firstandlastname"
245 "|nombre.*y.*apellidos" // es
246 "|^nom" // fr-FR
247 "|お名前|氏名" // ja-JP
248 "|^nome" // pt-BR, pt-PT
249 "|姓名" // zh-CN
250 "|성명"; // ko-KR
251 const char kNameSpecificRe[] =
252 "^name"
253 "|^nom" // fr-FR
254 "|^nome"; // pt-BR, pt-PT
255 const char kFirstNameRe[] =
256 "first.*name|initials|fname|first$|given.*name"
257 "|vorname" // de-DE
258 "|nombre" // es
259 "|forename|prénom|prenom" // fr-FR
260 "|名" // ja-JP
261 "|nome" // pt-BR, pt-PT
262 "|Имя" // ru
263 "|이름"; // ko-KR
264 const char kMiddleInitialRe[] = "middle.*initial|m\\.i\\.|mi$|\\bmi\\b";
265 const char kMiddleNameRe[] =
266 "middle.*name|mname|middle$"
267 "|apellido.?materno|lastlastname"; // es
268 const char kLastNameRe[] =
269 "last.*name|lname|surname|last$|secondname|family.*name"
270 "|nachname" // de-DE
271 "|apellido" // es
272 "|famille|^nom" // fr-FR
273 "|cognome" // it-IT
274 "|姓" // ja-JP
275 "|morada|apelidos|surename|sobrenome" // pt-BR, pt-PT
276 "|Фамилия" // ru
277 "|\\b성(?:[^명]|\\b)"; // ko-KR
278
279 /////////////////////////////////////////////////////////////////////////////
280 // phone_field.cc
281 /////////////////////////////////////////////////////////////////////////////
282 const char kPhoneRe[] =
283 "phone|mobile|contact.?number"
284 "|telefonnummer" // de-DE
285 "|telefono|teléfono" // es
286 "|telfixe" // fr-FR
287 "|電話" // ja-JP
288 "|telefone|telemovel" // pt-BR, pt-PT
289 "|телефон" // ru
290 "|电话" // zh-CN
291 "|(?:전화|핸드폰|휴대폰|휴대전화)(?:.?번호)?"; // ko-KR
292 const char kCountryCodeRe[] =
293 "country.*code|ccode|_cc";
294 const char kAreaCodeNotextRe[] =
295 "^\\($";
296 const char kAreaCodeRe[] =
297 "area.*code|acode|area"
298 "|지역.?번호"; // ko-KR
299 const char kPhonePrefixSeparatorRe[] =
300 "^-$|^\\)$";
301 const char kPhoneSuffixSeparatorRe[] =
302 "^-$";
303 const char kPhonePrefixRe[] =
304 "prefix|exchange"
305 "|preselection" // fr-FR
306 "|ddd"; // pt-BR, pt-PT
307 const char kPhoneSuffixRe[] =
308 "suffix";
309 const char kPhoneExtensionRe[] =
310 "\\bext|ext\\b|extension"
311 "|ramal"; // pt-BR, pt-PT
312 const char kUPIVirtualPaymentAddressRe[] =
313 "^\\w+@("
314 "upi|" // BHIM Bharat Interface for Money
315 "allbank|" // Allahabad Bank UPI
316 "andb|" // Andhra Bank ONE
317 "axisbank|" // Axis Pay
318 "barodampay|" // Baroda MPay
319 "mahb|" // MAHAUPI
320 "cnrb|" // Canara Bank UPI - Empower
321 "csbpay|" // CSB UPI
322 "dcb|" // DCB Bank
323 "federal|" // Lotza
324 "hdfcbank|" // HDFC Bank MobileBanking
325 "pockets|" // Pockets- ICICI Bank
326 "icici|" // Pockets- ICICI Bank
327 "idfcbank|" // IDFC Bank UPI App
328 "indus|" // Indus Pay
329 "kbl|" // KBL Smartz
330 "kaypay|" // KayPay
331 "pnb|" // PNB UPI
332 "sib|" // SIB M-Pay (UPI Pay)
333 "sbi|" // SBI Pay
334 "tjsp|" // TranZapp
335 "uco|" // UCO UPI
336 "unionbank|" // Union Bank UPI
337 "united|" // United UPI
338 "vijb|" // Vijaya UPI App
339 "ybl" // Yes Pay
340 ")$";
341
342 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_regex_constants.h ('k') | components/autofill/core/browser/credit_card_field.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698