FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » What this means "(\w|-)+@\w"?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: What this means "(\w|-)+@\w"? [message #174789 is a reply to message #174788] Fri, 08 July 2011 06:05 Go to previous messageGo to previous message
Eli the Bearded is currently offline  Eli the Bearded
Messages: 22
Registered: April 2011
Karma:
Junior Member
In comp.lang.php, Thomas 'PointedEars' Lahn <php(at)PointedEars(dot)de> wrote:
> Eli the Bearded wrote:
>> [0-9a-zA-z] broken attempt to match a number or letter
>> will also match [ ] \ ^ _ `
> Now come on, that is probably just a typo. Make the last `z' a `Z'
> (uppercase) and it will not match those extra characters (it will
> match too few addresses, though).

Yeah, but did you notice the strtolower() later on? It's just broken.

>> uses this email address precisely because it gets rejected by bad
>> verifiers
>
> ACK. Good to see it passed mine (and was subsequently SMTP-checked
> as being OK) :)
>
> atext="[A-Za-z0-9!#\$%&'*+/=?^_\`{|}~-]"
> dot_atom_text="$atext+(\\.$atext+)*"

RFC822 had that same dor rule, but I've never encountered mail
software that would reject an address with a final dot, eg
something like: <john.johnson.jr.@jrsite.example>

> dot_atom=$dot_atom_text
>
> if [ -z "`echo "$i" | egrep -e "${dot_atom}@${dot_atom}"`" ]; then

Hostnames have a pretty rigid syntax that can easily be checked.
Even punycoded international domain names will validate with this:

labeltext="[A-Za-z0-9][A-Za-z0-9-]{,62}"
hosttext="$labeltext(\\.$labeltext)*\\.?"

(I ignore the overall hostname length limit there. I'm pretty sure
it is 255 with dots.)

Trailing dots are used to anchor a hostname, legal but rarely seen.
If you owned a TLD and wanted to use it directly for email, the
trailing anchor dot would be a good idea: <vanity@mytld.>

With wildcard DNS, you can have some resolvers get an IP address
for invalid names, most often this seems to happen with underscores
used instead of hyphens. I figure those people are screwed and don't
worry about them.

> It is a shell script, but you can probably see how it works. It is derived
> directly from RFC 2822, section 3.4.1, which was current at the time it was
> written. Do I need to update it to RFC 5322 in any way?

I haven't looked at that closely enough to tell you.

Elijah
------
non-punycoded international domains are just for show
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: upgrade of php & split deprecated = HELP
Next Topic: Re: What is Islam?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 16:01:07 GMT 2024

Total time taken to generate the page: 0.05193 seconds