I don't think you can do that in one line, but you can do a loop:

<cfscript>
start = 1;
exit = false;
regexp = '(<A class=jargon
href="javascript:popUpJargonDefinition\([0-9]+\)">)([^<]*)(</a>)';
while(NOT exit){
        match = REFindNoCase(regexp,page,start,true);
        if(match.pos[1]){
                page = RemoveChars(page,match.pos[4],match.len[4]);
                page = RemoveChars(page,match.pos[2],match.len[2]);
                start = match.pos[1]+match.len[3];
        }
        else{
                exit = true;
        }
}
</cfscript>

-----Original Message-----
From: Oliver Cookson [mailto:[EMAIL PROTECTED] 
Sent: donderdag 20 maart 2003 10:43
To: CF-Talk
Subject: RE: RegEx Help! (more detail)


Hi Jochem,



Thanks for the reply (and the others who replied too!).



Ok let me explain myself a little better. I am outputting a page of 
text 

and if the user chooses to turn off the "jargon" links i want to 
strip 

all links that look like this out:



<A class=jargon 
href="javascript:popUpJargonDefinition(2)">article</A>



You say that would be easy? 



Well i want to keep the text inbetween the <A></A> tags (in this 

case "article") and the argument i am passing to the JS function 
could 

be ANY number (from 1 to 2000? As this is the ID of the jargon.)



I need to replace ALL occurences of this text within the large 
string.



I tried this RegEx below but it didn't work? (sorry for the 
text-wrap)



<CFSET bodyText = REReplaceNoCase

(publishGetArticleOnContentId.body1,'^.*<A class=jargon 

href="javascript:popUpJargonDefinition([0-9]*)">([^<]*)</a>.*$',"\1")> 



Thanks in advance and any help would be appreciated. :)



Oliver





> : -----Original Message-----

> : From: Jochem van Dieten [mailto:[EMAIL PROTECTED]

> : Sent: Friday, March 14, 2003 6:23 AM

> : To: CF-Talk

> : Subject: Re: SOT: RegEx Help!

> : Do you mean this string is part of a larger text? Use:

> : <cfset text = REReplaceNoCase(text,'^.*<A class=jargon

> :
href="javascript:popUpJargonDefinition([0-9]*)">(.*)</a>.*$',"\1")>

> : else:

> : <cfset text = REReplaceNoCase(text,'<A class=jargon

> : href="javascript:popUpJargonDefinition([0-9]*)">(.*)</a>',"\1")>

> :

> : Jochem




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to