Here you go...So you know, in regex:
x?!y matches x only if it is not followed by y
x?=y matches x only if it is followed by y
These are referred to as lookahead expressions

The attached file has that function I had mentioned.

Hope this helps you,
Mike

On Wed, 25 Aug 2004 12:08:37 -0500, Mike Kelp <[EMAIL PROTECTED]> wrote:
> I wrote a cfc to do things like this a while back...I'll see if I can
> send it to you shortly.
> I wrote it for adding smiley face code and securing HTML in a forum so
> it takes a list of accepted tags and removes the rest.
>
> I know this doesn't help you a lot now, but if I can find a good
> snippet of the code for you, I will get it to you.
>
> Mike
>
>
>
>
> ----- Original Message -----
> From: Cassidy Symons <[EMAIL PROTECTED]>
> Date: Wed, 25 Aug 2004 09:51:52 -0700
> Subject: RegEx - is it possible to strip all HTML except certain tags?
> To: CF-Talk <[EMAIL PROTECTED]>
>
> I've been testing this out and can't find a way to strip all HTML except
>  certain tags...is there any sort of 'not' modifier in RegEx in CF5, so I
>  could do something like:
>
>  <cfset mytext =
>  '#REReplaceNoCase(mytext,"</?(NOT{b,i,strong,p,etc...}[^>]*>","","all")#'>
>
>  Which would leave in tags that aren't really harmful. Obviously if need
>  be I can just replace those tags with some sort of code (that hopefully
>  doesn't happen to appear elsewhere in the text), run the RegEx function
>  to strip all other HTML, then switch the codes back to HTML, but that
>  seems like a rather inelegant way of going about it, not to mention slow
>  if this is being done to several text fields on the same page.
>
>  Can ColdFusion's RegEx functions accomplish this, or am I going to have
>  to figure out a workaround?
>
>  Thanks.
>
>  Cassidy________________________________
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to