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

[eluser]sophistry[/eluser]
yeah, it's me, back to back posts. but, i couldn't wait.

ok, i put on my REGEX thinking cap and came up with a way to exclude matching on multi-periods (a fix suggested by inparo):
Code:
preg_match_all(";([$chars_not_dot](?:[$chars_not_dot]|[.](?![.]))+)@((?:[-a-z0-9]+)\.(?:[-.a-z0-9]{2,}));i", $s, $matches);

it's pretty cool regex if i do say so myself; i used my first negative lookahead assertion.
Code:
[.](?![.]))

that little squeegee says "match a dot only if it is not followed by another dot."

EDIT: i changed the last part of the regex to look for at least 2 chars instead of the wildcard 0 or more * that was there on first post.


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