You can also fix you original expression by using ? to modify the greedy
match. 
<cfset attributes.description =
REreplace(attributes.description,'(.*?)<.*?>(.*?)','\1\2','all')/>


but Jerry's expression is probably better in your case. 

Russ

> -----Original Message-----
> From: Jerry Johnson [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, February 28, 2006 3:24 PM
> To: CF-Talk
> Subject: Re: Why doesn't this regular expression work?
> 
> It is running what is called a "greedy" search. So the first .* grabs
> the very largest set it can grab, followed by the largest <> it can
> grab, followed by what is left. What you describe is exactly what is
> written.
> 
> Since you don't really care about anything outside the <>, then just
> replace what is inside them
> 
> "<[^>]*>","","ALL"
> 
> On 2/28/06, Johnny Le <[EMAIL PROTECTED]> wrote:
> > I am trying to remove all HTML tags from the description.  Why doesn't
> this work?  It only replaces the last occurrence, just like when I specify
> "one" instead of "all", but it replaces the last occurrence instead of the
> first occurrence.
> >
> > <cfset attributes.description =
> REreplace(attributes.description,'(.*)<.*>(.*)','\1\2','all')/>
> >
> > Johnny
> >
> >
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:233680
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to