From 2e25c3923daff8308860064068205366238afcf1 Mon Sep 17 00:00:00 2001 From: luckman212 Date: Fri, 21 May 2021 15:42:53 -0400 Subject: [PATCH] quick fix to find 3-digit codes e.g. Zocdoc --- find-messages.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/find-messages.php b/find-messages.php index d831fd6..6ec98ce 100644 --- a/find-messages.php +++ b/find-messages.php @@ -60,7 +60,8 @@ and message.text is not null and length(message.text) > 0 and ( - message.text glob '*[0-9][0-9][0-9][0-9]*' + message.text glob '*[0-9][0-9][0-9]*' + or message.text glob '*[0-9][0-9][0-9][0-9]*' or message.text glob '*[0-9][0-9][0-9][0-9][0-9]*' or message.text glob '*[0-9][0-9][0-9][0-9][0-9][0-9]*' or message.text glob '*[0-9][0-9][0-9]-[0-9][0-9][0-9]*' @@ -124,6 +125,11 @@ // "Your verification code is: 1234, use it to log in" // "Here is your authorization code:9384" $code = $matches[2]; + } elseif (preg_match('/(code|is):?\s*(\d{3,8})($|\s|\R|\t|\b|\.|,)/i', $text, $matches)) { + // "code" OR "is" followed by an optional ":" + optional whitespace, then 3-8 consecutive digits + // examples: + // "Please enter code 548 on Zocdoc." + $code = $matches[2]; } elseif (preg_match('/(^|code:|is:|\b)\s*(\d{3})-(\d{3})($|\s|\R|\t|\b|\.|,)/', $text, $matches)) { // line beginning OR "code:" OR "is:" OR word boundary, optional whitespace, 3 consecutive digits, a hyphen, then 3 consecutive digits // but NOT a phone number (###-###-####)