Welcome Guest, Not a member yet? Register   Sign In
Email addresses with a "+" are not parsed correctly
#7

[eluser]sophistry[/eluser]
@inparo, thanks for the feedback! so you will decide for us what's acceptable in the RFC? sounds good to me - i wish someone would decide; email addresses are such a mess. :-) oh wait... they did decide: RFC2822.

seriously, the idea is to make it a complete listing of acceptable email address formats so that people don't keep filing bug reports for every character they want included in the "acceptable" list. this way, if someone wants to have auto_link() parse out an email with a colon in it, you just say 'sorry, your email is "out of scope of the RFC".' rather than 'sorry your email format is out of scope for CI.'

to address your insights into the regex: the current auto_link() code does not care about quoted strings so i didn't include code that deals with them. and as far as the other, ahem, shortcomings... those are also present in the current code: allows multiple periods and allows starting with a period.

i took a stab at fixing the regex to detect initial periods (regex gets kooky when you try to express something like multi-periods in the midst of a character class so i'm just going to leave it for now):

this will work to disallow initial periods (adds a "everything but a dot" character class for the first character)
Code:
$chars_not_dot = '-a-z0-9#!$%&*+/\'=?^_`{}|~';
if (preg_match_all("/([$chars_not_dot][$chars_not_dot.]+)@([-a-z0-9]+)\.([-.a-z0-9]*)/i", $str, $matches))


Messages In This Thread
Email addresses with a "+" are not parsed correctly - by El Forum - 08-28-2008, 07:59 PM
Email addresses with a "+" are not parsed correctly - by El Forum - 08-28-2008, 09:43 PM
Email addresses with a "+" are not parsed correctly - by El Forum - 08-28-2008, 09:50 PM
Email addresses with a "+" are not parsed correctly - by El Forum - 08-28-2008, 09:54 PM
Email addresses with a "+" are not parsed correctly - by El Forum - 08-28-2008, 10:17 PM
Email addresses with a "+" are not parsed correctly - by El Forum - 08-28-2008, 10:49 PM
Email addresses with a "+" are not parsed correctly - by El Forum - 08-28-2008, 11:11 PM
Email addresses with a "+" are not parsed correctly - by El Forum - 08-28-2008, 11:38 PM
Email addresses with a "+" are not parsed correctly - by El Forum - 08-29-2008, 09:58 AM
Email addresses with a "+" are not parsed correctly - by El Forum - 08-29-2008, 10:29 AM
Email addresses with a "+" are not parsed correctly - by El Forum - 08-29-2008, 12:07 PM
Email addresses with a "+" are not parsed correctly - by El Forum - 08-29-2008, 12:26 PM
Email addresses with a "+" are not parsed correctly - by El Forum - 08-30-2008, 04:20 PM
Email addresses with a "+" are not parsed correctly - by El Forum - 09-01-2008, 12:02 AM
Email addresses with a "+" are not parsed correctly - by El Forum - 09-10-2008, 10:25 PM
Email addresses with a "+" are not parsed correctly - by El Forum - 09-11-2008, 06:45 AM
Email addresses with a "+" are not parsed correctly - by El Forum - 09-11-2008, 07:47 AM



Theme © iAndrew 2016 - Forum software by © MyBB