[thelist] RegExp - how to say "not this string"

Sarah Sweeney mr.sanders at designshift.com
Tue May 11 14:30:02 CDT 2004


> I think you'll want a negative lookahead assert for this.  If memory serves,
> CF does not support this syntax.  Here's an example from a URL ReWrite
> engine:
> 
> "
> For example you need to move all users not using Internet Explorer to the
> other location:
> 
> RewriteCond  User-Agent: (?!.*MSIE).*
> RewriteRule  (.*) /nonie$1
> "
> 
>>From this example, you can derive how they work.
> 
> http://www.regular-expressions.info/lookaround.html

Joshua,

I'm not using this regexp in ColdFusion, I'm using it in the Homesite 
find and replace box; however, you may be correct anyway, it probably 
does not support the lookaround assertions. Anyway, I found a way around 
my problem. I replaced all instances of "</th>" with "~/th>", because I 
knew the tilde wouldn't appear in any heading. It's not as elegant as a 
simple regexp, but it does the trick. When I'm done, I just fix all the 
instances of "~/th>" and Bob's your uncle (or is that "my uncle"?).

Thanks for the help anyway, I will read the tutorial you referred to.

Sarah





More information about the thelist mailing list