ok, lemme try and break this down:

^[^<]  anything at the beginning of the string that is NOT an opening
bracket (which would take care of the FirstName LastName and any spaces)

+< an opening bracket

([^>]+)  this is where I start to get lost.  I know the [^>] is anything
that is not a closing bracket...but not sure where the + comes in inside of
the parentheses.

>.*$ a closing bracket, and anything that might follow it (such as trailing
spaces).

Also, I know the \1 is a 'backreference'...just not exactly sure what that
means.  If you could clarify the ([^>]+) and the \1 I'd be eternally
grateful :)

Charlie

----- Original Message -----
From: "Barney Boisvert" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, May 12, 2004 10:03 AM
Subject: RE: Regex Q

> 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