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 (###-###-####)