Yes, you can do it using a regex construct called a lookahead (in this case a 
negative lookahead), like so:

&(?!nbsp;)

To only match ampersands that aren't part of any entity (not just  ), you 
can use this:

&(?!#?\w+;)

Steve
http://blog.stevenlevithan.com

> Subject: Find ampersands that are not part of an entity.
> From: [EMAIL PROTECTED]
> To: [email protected]
> Date: Fri, 2 May 2008 14:14:23 -0700
> 
> I need to search a very long string for ampersands (&) that are not part 
> of the non-breaking space entity ( ) and replace them with the 
> ampersand entity (&).
> 
> Using regex can I say select all instances of a character NOT followed 
> by specific other characters?
> 
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: http://www.houseoffusion.com/groups/RegEx/message.cfm/messageid:1140
Subscription: http://www.houseoffusion.com/groups/RegEx/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21

Reply via email to