aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCullen Walsh <ckwalsh@phpbb.com>2010-07-11 15:35:31 -0700
committerCullen Walsh <ckwalsh@phpbb.com>2010-07-11 16:22:26 -0700
commit593e193bdc7bab20ec8460348b2fe597355dccda (patch)
treef39e71674822f129f674590740b61ee3471719d3
parenta0b9f7806a6c3b08dd2c7e9cccfc7f742e42be1d (diff)
downloadforums-593e193bdc7bab20ec8460348b2fe597355dccda.tar
forums-593e193bdc7bab20ec8460348b2fe597355dccda.tar.gz
forums-593e193bdc7bab20ec8460348b2fe597355dccda.tar.bz2
forums-593e193bdc7bab20ec8460348b2fe597355dccda.tar.xz
forums-593e193bdc7bab20ec8460348b2fe597355dccda.zip
[ticket/9715] Better email regex
Using email regex created by James Watts and Francisco Jose Martin Moreno. This passes many more tests for RFC valid emails. PHPBB3-9715
-rw-r--r--phpBB/includes/functions.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 9c74a524ee..bc3d721de5 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -3355,7 +3355,9 @@ function get_preg_expression($mode)
switch ($mode)
{
case 'email':
- return '(?:[a-z0-9\'\.\-_\+\|]++|&amp;)+@[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\!\#$\%\'\*\+\-\/\=\?\^\`{\|\}\~]|&amp;)+@((((([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':