From 406a5003e0f1f7748ceb957da55bfb79e26ff156 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Wed, 18 Nov 2026 20:17:39 -0800 Subject: [PATCH] Keep a code private before "thanks," with a trailing comma Co-authored-by: Manjunath Paparaju --- src/search/placeSuggestions.js | 6 +++--- src/search/placeSuggestions.test.mjs | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/search/placeSuggestions.js b/src/search/placeSuggestions.js index 879ae5ce69..6438b804e5 100644 --- a/src/search/placeSuggestions.js +++ b/src/search/placeSuggestions.js @@ -423,7 +423,7 @@ function codeAfterLabel(line) { // After a label in lower case, any value is a code ("verification code // Abc"); after one written as a name, only a value that is not one. const coded = - /\b((?:otp|2fa|mfa|cvv|cvc|(?:verification|one-time|security|auth|login) code)(?:\s+is)?)\s+([a-z0-9][a-z0-9-]{2,63})(?:(?:\s*[,;]\s*|\s+[-–—]+\s+|\s+)(?:thanks|thank you|thx|ty|cheers|please|pls|ok|now)(?:\s+(?:a lot|so much|very much|again))?)?[\s.!?]*$/i.exec( + /\b((?:otp|2fa|mfa|cvv|cvc|(?:verification|one-time|security|auth|login) code)(?:\s+is)?)\s+([a-z0-9][a-z0-9-]{2,63})(?:(?:\s*[,;]\s*|\s+[-–—]+\s+|\s+)(?:thanks|thank you|thx|ty|cheers|please|pls|ok|now)(?:\s+(?:a lot|so much|very much|again))?)?[\s.,!?]*$/i.exec( line, ); if (coded) { @@ -450,7 +450,7 @@ function codeAfterLabel(line) { } // A value in mixed case that is no name ("PIN aBcD", "gate code aBcD"). const mixed = - /\b(?:pin|(?:door|access|gate|alarm|entry) code)(?:\s+is)?\s+([a-z0-9-]{4,64})(?:(?:\s*[,;]\s*|\s+[-–—]+\s+|\s+)(?:thanks|thank you|thx|ty|cheers|please|pls|ok|now)(?:\s+(?:a lot|so much|very much|again))?)?[\s.!?]*$/i.exec( + /\b(?:pin|(?:door|access|gate|alarm|entry) code)(?:\s+is)?\s+([a-z0-9-]{4,64})(?:(?:\s*[,;]\s*|\s+[-–—]+\s+|\s+)(?:thanks|thank you|thx|ty|cheers|please|pls|ok|now)(?:\s+(?:a lot|so much|very much|again))?)?[\s.,!?]*$/i.exec( line, ); if ( @@ -461,7 +461,7 @@ function codeAfterLabel(line) { ) return true; const match = - /\b((?:pin|cvv|cvc|otp|2fa|mfa|(?:door|access|gate|alarm|entry|security|verification|one-time|auth|login) code)(?:\s+is)?)\s+([a-z0-9][a-z0-9-]{3,63})(?:(?:\s*[,;]\s*|\s+[-–—]+\s+|\s+)(?:thanks|thank you|thx|ty|cheers|please|pls|ok|now)(?:\s+(?:a lot|so much|very much|again))?)?[\s.!?]*$/i.exec( + /\b((?:pin|cvv|cvc|otp|2fa|mfa|(?:door|access|gate|alarm|entry|security|verification|one-time|auth|login) code)(?:\s+is)?)\s+([a-z0-9][a-z0-9-]{3,63})(?:(?:\s*[,;]\s*|\s+[-–—]+\s+|\s+)(?:thanks|thank you|thx|ty|cheers|please|pls|ok|now)(?:\s+(?:a lot|so much|very much|again))?)?[\s.,!?]*$/i.exec( line, ); if (!match) return false; diff --git a/src/search/placeSuggestions.test.mjs b/src/search/placeSuggestions.test.mjs index 223a683201..c310dcfd60 100644 --- a/src/search/placeSuggestions.test.mjs +++ b/src/search/placeSuggestions.test.mjs @@ -471,6 +471,7 @@ test('spelled-out emails, addresses, phrases, codes and short phone numbers stay 'verification code ABCDEF thanks a lot', 'otp ABCDEF cheers', 'otp ab12cd - thanks', + 'gate code aBcD - thanks,', 'gate code aBcD – thanks', '"abandon ability able about above absent absorb abstract absurd abuse access accident"', 'abandon-ability-able-about-above-absent-absorb-abstract-absurd-abuse-access-accident',