This'll do it:

Rereplace(email, "^[^<]+<([^>]+)>.*$", "\1", "one")

I threw the extra ".*" in there at the end because the possibility of having
trailing spaces is always there, and we can clean it up at the same time, so
why not?

Cheers,
barneyb

> -----Original Message-----
> From: Charlie Griefer [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 12, 2004 9:59 AM
> To: CF-Talk
> Subject: Regex Q
>
> On another forum, a user asked how to turn this string:
>
> FirstName LastName <[EMAIL PROTECTED]>
>
> into this string:
>
> [EMAIL PROTECTED]
>
> I was able to come up with:
>
> <cfset email = reReplace(left(email, len(email)-1), '(^.*<)',
> '', 'all')>
>
> I feel a little cheesy using the left() function to remove that last
> bracket, as I'm sure there must have been a way within the same regex.
>
> I tried a variety of things, such as adding .$ and even the
> literal > to the
> _expression_ above, but I assume that means it was looking for
> that _expression_
> as an _expression_ itself.  But there has to be a way to say,
> replace (this
> exp) AND (that exp)?  or would it just be a case of nesting
> reReplace()
> functions?
>
> Charlie
> -still trying to get a handle on regex
>
>
>
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to