Today, I needed (?!x)y but JavaScript does not implement (yet?) this regexp... sigh...

Update: I need in fact to replace all occurences of @ if at beginning of string or not preceeded by a backslash; answer by Dan Veditz: yourString.replace(/^@|([^\\])@/g,"$1your_replacement_string") :-) Thanks Dan!