[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
This commit is contained in:
rxu 2015-02-17 17:24:30 +07:00
parent 088907fe8e
commit fa1c61f608

View file

@ -3347,7 +3347,7 @@ function get_preg_expression($mode)
case 'email': case 'email':
// Regex written by James Watts and Francisco Jose Martin Moreno // Regex written by James Watts and Francisco Jose Martin Moreno
// http://fightingforalostcause.net/misc/2006/compare-email-regex.php // 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; break;
case 'bbcode_htm': case 'bbcode_htm':