Skip to content

Commit

Permalink
[ticket/9715] Better email regex
Browse files Browse the repository at this point in the history
Using email regex created by James Watts and Francisco Jose Martin Moreno.
This passes many more tests for RFC valid emails.

PHPBB3-9715
  • Loading branch information
Cullen Walsh committed Jul 11, 2010
1 parent a0b9f78 commit 593e193
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion phpBB/includes/functions.php
Expand Up @@ -3355,7 +3355,9 @@ function get_preg_expression($mode)
switch ($mode)
{
case 'email':
return '(?:[a-z0-9\'\.\-_\+\|]++|&)+@[a-z0-9\-]+\.(?:[a-z0-9\-]+\.)*[a-z]+';
// 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,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)';
break;

case 'bbcode_htm':
Expand Down

0 comments on commit 593e193

Please sign in to comment.