Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #2468

Re: What this means "(\w|-)+@\w"?

Message-Id <1529333.qVoOGUtdWV@PointedEars.de>
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2011-07-07 21:12 +0200
Subject Re: What this means "(\w|-)+@\w"?
Newsgroups comp.lang.php
References <b2cdc780-b6d4-4b6e-a01e-444a616c0fe0@r18g2000vbs.googlegroups.com> <eli$1107071405@qz.little-neck.ny.us>
Followup-To comp.lang.php

Followups directed to: comp.lang.php

Show all headers | View raw


Eli the Bearded wrote:

> In comp.lang.php, zhang yun  <bigzhangyun@gmail.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

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

What this means "(\w|-)+@\w"? zhang yun <bigzhangyun@gmail.com> - 2011-07-07 06:58 -0700
  Re: What this means "(\w|-)+@\w"? Michael Fesser <netizen@gmx.de> - 2011-07-07 17:39 +0200
  Re: What this means "(\w|-)+@\w"? Eli the Bearded <*@eli.users.panix.com> - 2011-07-07 18:23 +0000
    Re: What this means "(\w|-)+@\w"? Michael Fesser <netizen@gmx.de> - 2011-07-07 21:12 +0200
    Re: What this means "(\w|-)+@\w"? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-07-07 21:12 +0200
      Re: What this means "(\w|-)+@\w"? Eli the Bearded <*@eli.users.panix.com> - 2011-07-08 06:05 +0000
  Re: What this means "(\w|-)+@\w"? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-07-08 08:42 +0200
    Re: What this means "(\w|-)+@\w"? Sandman <mr@sandman.net> - 2011-08-02 10:06 +0200
      Re: What this means "(\w|-)+@\w"? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-08-02 11:50 +0200
        Re: What this means "(\w|-)+@\w"? "Peter H. Coffin" <hellsop@ninehells.com> - 2011-08-02 07:56 -0500
          Re: What this means "(\w|-)+@\w"? Eli the Bearded <*@eli.users.panix.com> - 2011-08-02 20:53 +0000
            Re: What this means "(\w|-)+@\w"? "Peter H. Coffin" <hellsop@ninehells.com> - 2011-08-03 08:32 -0500
          Re: What this means "(\w|-)+@\w"? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-08-03 10:55 +0200
            Re: What this means "(\w|-)+@\w"? "Peter H. Coffin" <hellsop@ninehells.com> - 2011-08-03 08:46 -0500
        Re: What this means "(\w|-)+@\w"? Sandman <mr@sandman.net> - 2011-08-03 00:21 +0200
          Re: What this means "(\w|-)+@\w"? Eli the Bearded <*@eli.users.panix.com> - 2011-08-03 07:45 +0000
            Re: What this means "(\w|-)+@\w"? Sandman <mr@sandman.net> - 2011-08-03 10:02 +0200
              Re: What this means "(\w|-)+@\w"? Eli the Bearded <*@eli.users.panix.com> - 2011-08-05 00:05 +0000

csiph-web