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

Unified Diff: components/autofill/core/browser/autofill_regex_constants.cc

Issue 1515553005: Label non-capturing groups if no capturing needed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/autofill/core/browser/form_field_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/autofill_regex_constants.cc
diff --git a/components/autofill/core/browser/autofill_regex_constants.cc b/components/autofill/core/browser/autofill_regex_constants.cc
index d4b49cbb4387d83b5873004647eb5945988093e2..53138f192082719068324bd6eaf0e079bb1a6877 100644
--- a/components/autofill/core/browser/autofill_regex_constants.cc
+++ b/components/autofill/core/browser/autofill_regex_constants.cc
@@ -10,7 +10,7 @@
// This macro is to workaround the fact that RE2 library only supports ASCII
// word boundaries and it is supposed to be the same as \b.
-#define WORDBREAK "(\\A|\\z|\\PL)"
+#define WORDBREAK "(?:\\A|\\z|\\PL)"
namespace autofill {
@@ -34,7 +34,7 @@ const char kCompanyRe[] =
"|회사|직장"; // ko-KR
const char kAddressLine1Re[] =
"address.*line|address1|addr1|street"
- "|(shipping|billing)address$"
+ "|(?:shipping|billing)address$"
"|strasse|straße|hausnummer|housenumber" // de-DE
"|house.?name" // en-GB
"|direccion|dirección" // es
@@ -128,8 +128,8 @@ const char kStateRe[] =
// credit_card_field.cc
/////////////////////////////////////////////////////////////////////////////
const char kNameOnCardRe[] =
- "card.?(holder|owner)|name.*" WORDBREAK "on" WORDBREAK ".*card"
- "|(card|cc).?name|cc.?full.?name"
+ "card.?(?:holder|owner)|name.*" WORDBREAK "on" WORDBREAK ".*card"
+ "|(?:card|cc).?name|cc.?full.?name"
"|karteninhaber" // de-DE
"|nombre.*tarjeta" // es
"|nom.*carte" // fr-FR
@@ -141,7 +141,7 @@ const char kNameOnCardRe[] =
const char kNameOnCardContextualRe[] =
"name";
const char kCardNumberRe[] =
- "(card|cc|acct).?(number|#|no|num)"
+ "(?:card|cc|acct).?(?:number|#|no|num)"
"|nummer" // de-DE
"|credito|numero|número" // es
"|numéro" // fr-FR
@@ -179,7 +179,7 @@ const char kExpirationMonthRe[] =
"|月"; // zh-CN
const char kExpirationYearRe[] =
"exp|^/|year"
- "|ablaufdatum|gueltig|gültig|yahr" // de-DE
+ "|ablaufdatum|gueltig|gültig|jahr" // de-DE
vabr (Chromium) 2015/12/10 14:07:02 Yawohl! :)
"|fecha" // es
"|scadenza" // it-IT
"|有効期限" // ja-JP
@@ -189,7 +189,7 @@ const char kExpirationYearRe[] =
// The "yy" portion of the regex is just looking for two adjacent y's.
const char kExpirationDate2DigitYearRe[] =
- "(exp.*date.*|mm\\s*[-/]\\s*)[^y]yy([^y]|$)";
+ "(?:exp.*date.*|mm\\s*[-/]\\s*)[^y]yy([^y]|$)";
const char kExpirationDate4DigitYearRe[] =
"^mm\\s*[-/]\\syyyy$";
const char kExpirationDateRe[] =
@@ -204,7 +204,7 @@ const char kExpirationDateRe[] =
const char kGiftCardRe[] =
"gift.?card";
const char kDebitGiftCardRe[] =
- "(visa|mastercard|discover|amex|american express).*gift.?card";
+ "(?:visa|mastercard|discover|amex|american express).*gift.?card";
const char kDebitCardRe[] =
"debit.*card";
@@ -219,7 +219,7 @@ const char kEmailRe[] =
"|Электронной.?Почты" // ru
"|邮件|邮箱" // zh-CN
"|電郵地址" // zh-TW
- "|(이메일|전자.?우편|[Ee]-?mail)(.?주소)?"; // ko-KR
+ "|(?:이메일|전자.?우편|[Ee]-?mail)(.?주소)?"; // ko-KR
/////////////////////////////////////////////////////////////////////////////
@@ -229,7 +229,7 @@ const char kNameIgnoredRe[] =
"user.?name|user.?id|nickname|maiden name|title|prefix|suffix"
"|vollständiger.?name" // de-DE
"|用户名" // zh-CN
- "|(사용자.?)?아이디|사용자.?ID"; // ko-KR
+ "|(?:사용자.?)?아이디|사용자.?ID"; // ko-KR
const char kNameRe[] =
"^name|full.?name|your.?name|customer.?name|bill.?name|ship.?name"
"|name.*first.*last|firstandlastname"
@@ -280,7 +280,7 @@ const char kPhoneRe[] =
"|telefone|telemovel" // pt-BR, pt-PT
"|телефон" // ru
"|电话" // zh-CN
- "|(전화|핸드폰|휴대폰|휴대전화)(.?번호)?"; // ko-KR
+ "|(?:전화|핸드폰|휴대폰|휴대전화)(?:.?번호)?"; // ko-KR
const char kCountryCodeRe[] =
"country.*code|ccode|_cc";
const char kAreaCodeNotextRe[] =
« no previous file with comments | « no previous file | components/autofill/core/browser/form_field_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698