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 #174788 is a reply to message #174786] Thu, 07 July 2011 19:12 Go to previous messageGo to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma:
Senior Member
Eli the Bearded wrote:

> In comp.lang.php, zhang yun <bigzhangyun(at)gmail(dot)com> wrote:
>> $reg ='/^[0-9a-zA-z](\w|-)+@\w+\.('.$str.')$/';
>
> This bit makes a larger "perl compatable" regular expression ("pcre").

_P_erl_-_compat_i_ble (_PCRE_). (You nitpick, I nitpick ;-))

> ^ anchor to start of string
> [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).

> Elijah
> ------
> 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+)*"
dot_atom=$dot_atom_text

if [ -z "`echo "$i" | egrep -e "${dot_atom}@${dot_atom}"`" ]; then
# not syntactically valid
fi

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?


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
[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: Sat Nov 30 16:41:56 GMT 2024

Total time taken to generate the page: 0.04328 seconds