in reply to using regex to not match a string

[...] is a character class. You want (?!...) (see perlre). e.g., /&(?!amp;)/

Update: Darn. Too slow. :-) (Although I got the semicolon ;->)