From fa1c61f608aaa8e5b228be5604acc8c95d2de0b6 Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 17 Feb 2015 17:24:30 +0700 Subject: [PATCH] [ticket/13433] Fix parsing of email addresses Currently email addresses are parsed incorrectly due to the regex structure. Namely, if localpart consists of several dot separated parts, only the last part with the trailing dot will be captured. The patch change this behavior to capture the whole localpart. PHPBB3-13433 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 940484a0ea..4159af5678 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3347,7 +3347,7 @@ function get_preg_expression($mode) case 'email': // Regex written by James Watts and Francisco Jose Martin Moreno // http://fightingforalostcause.net/misc/2006/compare-email-regex.php - return '([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*(?:[\w\!\#$\%\'\*\+\-\/\=\?\^\`{\|\}\~]|&)+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,63})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)'; + return '((?:[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*(?:[\w\!\#$\%\'\*\+\-\/\=\?\^\`{\|\}\~]|&)+)@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,63})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)'; break; case 'bbcode_htm':