Re: [PHP] Strip emails from a document

2013-01-26 Thread Tedd Sperling
On Jan 26, 2013, at 12:48 PM, shiplu wrote: > What is your input? > Check my first email in this thread. Cheers, tedd _ t...@sperling.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Strip emails from a document

2013-01-26 Thread shiplu
What is your input? On Sat, Jan 26, 2013 at 11:29 PM, Tedd Sperling wrote: > > On Jan 26, 2013, at 12:20 PM, Daniel Brown wrote: > > > >It's imperfect, but will work for the majority of emails: > > > > > function scrape_emails($input) { > > > > preg_match_all("/\b([a-z0-9%\._\+\-]+@[a-

Re: [PHP] Strip emails from a document

2013-01-26 Thread Tedd Sperling
On Jan 26, 2013, at 12:20 PM, Daniel Brown wrote: > >It's imperfect, but will work for the majority of emails: > > function scrape_emails($input) { > > preg_match_all("/\b([a-z0-9%\._\+\-]+@[a-z0-9-\.]+\.[a-z]{2,6})\b/Ui",$input,$matches); >return $matches; > } > ?> It wor

Re: [PHP] Strip emails from a document

2013-01-26 Thread Jonathan Sundquist
If you are expecting the email address to always be the same but the first part being different you can create a regular expression to match it that way. Using a regular expression over all is going to be your best bet as shiplu suggested. On Sat, Jan 26, 2013 at 10:54 AM, shiplu wrote: > I thi

Re: [PHP] Strip emails from a document

2013-01-26 Thread shiplu
I think you meant extract emails from document, right? I'd probably find `@` and iterate before and after unless I get posix punct, space, characters. But it'll probably give some false matches. So its really hard to find 100% emails from an arbitrary text. This is because valid email can contain

[PHP] Strip emails from a document

2013-01-26 Thread Tedd Sperling
Hi gang: I thought I had a function to strip emails from a document, but I can't find it. So, before I start writing a common script, do any of you have a simple script to do this? Here's an example of the problem: Before: "Will Alex" ;"Moita Zact" ;"Bob Arms" ;"Meia Terms" ; After: ale...