Re: Regex help

From: Date: Sun, 07 Aug 2005 16:54:01 +0000
Subject: Re: Regex help
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-220177@lists.php.net to get a copy of this message
On 8/4/05, Lizet Pena de Sola <mailinglist@theniceweb.com> wrote: > Ok, it's not the regexp for detecting email addresses what I need, > that's widely published, thanks. I'm using ereg to match this regular > expression: > > (On)[\s\w\d\W\S\D\n]*(wr[i|o]te[s]?:) > > That will match phrases like > "On 8/3/05, Carol Swinehart <cshart@greenapple.edu> wrote:" > the type "On date, name <email> wrote or writes:" > > The thing is I tried this regexp with Regex Coach and it matches fine, > but ereg returns no match > > ereg($regexpstr, $str, $regs) > > I know there are some comments at php.net about how ereg has some bugs, > any idea if this could be one? > > Tia, > Lizet You're not going to get far with that. Lots of people make 'funny' You Wrote lines, and not all of them start with 'On' or contain the word 'wr[o|i]te'. You might be better off just searching for any sentance that contains an @ sign, because they are very seldom used outside of email addresses nowadays. And that doesn't make any promises, either, because sometimes the whole email address isn't in the line, just the person's name. Dotan Cohen http://lyricslist.com/lyrics/artist_albums/286/judas_priest.php Judas Priest Song Lyrics

« previous php.general (#220177) next »