RE: Reliably stripping out only the email address?

2004-06-11 Thread Pascal Peters
Bryan,

If you want to strip all email addresses like below, use this:

REReplaceNoCase(str,"<[EMAIL PROTECTED],}>?","","all")

If you want to extract the email address:

REReplaceNoCase(str,"^.*([EMAIL PROTECTED],}).*$","\1")

Pascal

> -Original Message-
> From: Bryan F. Hogan [mailto:[EMAIL PROTECTED] 
> Sent: donderdag 10 juni 2004 19:00
> To: CF-Talk
> Subject: Re: Reliably stripping out only the email address?
> 
> Hi Mike it works on all but the last index.
> 
> Thanks for the script.
> 
> Mike Townend wrote:
> > 
> > function ExtractEmail(sString)
> > {
> > return trim(ReReplace(sString, ".*<([^>]*)>.*", "\1")); } 
> >  
> '[EMAIL PROTECTED],<[EMAIL PROTECTED]>,DisplayName
> > <[EMAIL PROTECTED]>,"DisplayName" <[EMAIL PROTECTED]>,[EMAIL PROTECTED] 
> (DisplayName)'>
> > 
> > 
> > #ExtractEmail(idxFoo)#
> > 
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: Reliably stripping out only the email address?

2004-06-10 Thread Paul Vernon
Bryan,

Take a look at this as an example. Its rough and ready but works in all your
test cases






 
ReFindNoCase("([^\x01-\x20\;\""\,])[EMAIL PROTECTED];\""\,]*(\.[a-zA-Z]{2,
})*", teststring, startpos, True)>
 
  #st1.pos[1]#; length is #st1.len[1]#
#ReplaceList(Mid(testString,st1.pos[1],st1.len[1]), "<,>",
"")#
  
  
  
  
  
 
  
 


Paul
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: Reliably stripping out only the email address?

2004-06-10 Thread Bryan F. Hogan
"the docs are quite extensive."

They are indeed!
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: Reliably stripping out only the email address?

2004-06-10 Thread Bryan F. Hogan
Hi Mike it works on all but the last index.

Thanks for the script.

Mike Townend wrote:
> 
> function ExtractEmail(sString)
> {
> return trim(ReReplace(sString, ".*<([^>]*)>.*", "\1"));
> }
> 
> 
> 
> 
> #ExtractEmail(idxFoo)#
> 
> 
> works fine on all but the last entry, I havnt come across any of ours
> that had that format so havnt worried about it :)
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: Reliably stripping out only the email address?

2004-06-10 Thread Thomas Chiverton
On Thursday 10 Jun 2004 15:54 pm, Bryan F. Hogan wrote:
> Pascal, this returns to me the first position that it finds the email
> address on. It does not strip out the email address from a string. 

It will if you use a different RE function/argument in CF... the docs are 
quite extensive.

-- 
Tom Chiverton 
Advanced ColdFusion Programmer

Tel: +44(0)1749 834997
email: [EMAIL PROTECTED]
BlueFinger Limited
Underwood Business Park
Wookey Hole Road, WELLS. BA5 1AF
Tel: +44 (0)1749 834900
Fax: +44 (0)1749 834901
web: www.bluefinger.com
Company Reg No: 4209395 Registered Office: 2 Temple Back East, Temple
Quay, BRISTOL. BS1 6EG.
*** This E-mail contains confidential information for the addressee
only. If you are not the intended recipient, please notify us
immediately. You should not use, disclose, distribute or copy this
communication if received in error. No binding contract will result from
this e-mail until such time as a written document is signed on behalf of
the company. BlueFinger Limited cannot accept responsibility for the
completeness or accuracy of this message as it has been transmitted over
public networks.***
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: Reliably stripping out only the email address?

2004-06-10 Thread Pascal Peters
Use REReplaceNoCase instead of REFindNoCase 

> -Original Message-
> From: Bryan F. Hogan [mailto:[EMAIL PROTECTED] 
> Sent: donderdag 10 juni 2004 16:54
> To: CF-Talk
> Subject: Re: Reliably stripping out only the email address?
> 
> Pascal, this returns to me the first position that it finds 
> the email address on. It does not strip out the email address 
> from a string. Of course if I'm doing it correctly.
>
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: Reliably stripping out only the email address?

2004-06-10 Thread Mike Townend

function ExtractEmail(sString)
{
    return trim(ReReplace(sString, ".*<([^>]*)>.*", "\1"));
}




    #ExtractEmail(idxFoo)#


works fine on all but the last entry, I havnt come across any of ours 
that had that format so havnt worried about it :)

HTH

Jedi

Bryan F. Hogan wrote:

> Thanks
>
> I think this only strips out a string between the lt and gt
>
> Happen to have one that will work on these?
>
> [EMAIL PROTECTED]
> <[EMAIL PROTECTED]>
> DisplayName <[EMAIL PROTECTED]>
> "DisplayName" <[EMAIL PROTECTED]>
> [EMAIL PROTECTED] (DisplayName)
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: Reliably stripping out only the email address?

2004-06-10 Thread Bryan F. Hogan
Pascal, this returns to me the first position that it finds the email 
address on. It does not strip out the email address from a string. Of 
course if I'm doing it correctly.

Pascal Peters wrote:
> [-_a-z0-9]+(\.[-_a-z0-9]+)[EMAIL PROTECTED](\.[-a-z0-9]+)*\.([a-z]{2,3}|aero|
> coop|info|museum|name)
> 
> If you are concerned that the last group wont be reliable enough, you
> could use:
> [-_a-z0-9]+(\.[-_a-z0-9]+)[EMAIL PROTECTED](\.[-a-z0-9]+)*\.[a-z]{2,}
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: Reliably stripping out only the email address?

2004-06-10 Thread Pascal Peters
[-_a-z0-9]+(\.[-_a-z0-9]+)[EMAIL PROTECTED](\.[-a-z0-9]+)*\.([a-z]{2,3}|aero|
coop|info|museum|name)

If you are concerned that the last group wont be reliable enough, you
could use:
[-_a-z0-9]+(\.[-_a-z0-9]+)[EMAIL PROTECTED](\.[-a-z0-9]+)*\.[a-z]{2,}

> -Original Message-
> From: Bryan F. Hogan [mailto:[EMAIL PROTECTED] 
> Sent: woensdag 9 juni 2004 23:27
> To: CF-Talk
> Subject: Reliably stripping out only the email address?
> 
> Does anyone have a Regex they can share that reliably strips 
> out only the email address from the from address of a cfpop download?
> 
>
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: Reliably stripping out only the email address?

2004-06-10 Thread Bryan F. Hogan
Thanks

I think this only strips out a string between the lt and gt

Happen to have one that will work on these?

[EMAIL PROTECTED]
<[EMAIL PROTECTED]>
DisplayName <[EMAIL PROTECTED]>
"DisplayName" <[EMAIL PROTECTED]>
[EMAIL PROTECTED] (DisplayName)

Mike Townend wrote:

> Hi,
> 
> We tend to use this...
> 
> //This function returns everything between a < and a >
> function ExtractEmail(sString)
> {
> return trim(ReReplace(sString, ".*<([^>]*)>.*", "\1"));
> }
> 
> and seems to be working OK
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: Reliably stripping out only the email address?

2004-06-10 Thread Mike Townend
Hi,

We tend to use this...

//This function returns everything between a < and a >
function ExtractEmail(sString)
{
    return trim(ReReplace(sString, ".*<([^>]*)>.*", "\1"));
}

and seems to be working OK

HTH

Jedi

Bryan F. Hogan wrote:

> Does anyone have a Regex they can share that reliably strips out only
> the email address from the from address of a cfpop download?
>
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]