the following will loop through and extract any email in a block of text and
store each one in an array: (watch for wrap)
<cfscript>
regex = "^[a-z0-9][-\._a-z0-9]*@([a-z0-9][-a-z0-9]*\.)+[a-z]{2,6}$";
emails = arraynew(1);
apos = refindnocase(regex, myText, 1, true);
while (apos.len[1]) {
arrayappend(emails, mid(myText, apos.pos[1],apos.len[1]));
apos = refindnocase(regex, myText, apos.pos[1]+1, true);
}
</cfscript>
be careful, I use this code for parsing out html links, not emails, so I've
just subbed in the regex for valid emails that I use elsewhere. Please test
to your satisfaction. I haven't tested it, but its along the right lines.
You may need to alter it to properly fit the circumstances.
Rich
> -----Original Message-----
> From: Paul Fennell [mailto:[EMAIL PROTECTED]
> Sent: 26 November 2003 09:25
> To: [EMAIL PROTECTED]
> Subject: RE: [ cf-dev ] Email Extractor
>
>
> This might help in your adventure
>
> http://search.cpan.org/~miyagawa/Email-Find-0.09/lib/Email/Find.pm
>
> -----Original Message-----
> From: Allan Cliff [mailto:[EMAIL PROTECTED]
> Sent: 26 November 2003 09:12
> To: CF - List
> Subject: [ cf-dev ] Email Extractor
>
> I mailed the list a few weeks ago about extracting emails
> from a "text" field in an SQL database.
>
> I was thinking of a way to do this could be to use regex to
> delete any word that doesn't have an "@" sign.
>
> Anyone help me?
>
> Thanks
> Allan
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.543 / Virus Database: 337 - Release Date: 21/11/2003
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.543 / Virus Database: 337 - Release Date: 21/11/2003
>
>
>
> --
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED] For human help, e-mail:
> [EMAIL PROTECTED]
>
--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]