Should be an easy question from someone out there:
If I run this JavaScript:
var regex = new RegExp(\"(?!cat)dog(?!cat)\",\"g\"); va
Your regex simplifies to dog(?!cat) (because the first lookbehind consumes nothing), so it is replacing any instance of dog that is not followed by cat.
dog(?!cat)
dog
cat
Try the regex (?!cat).{3}dog(?!cat)
(?!cat).{3}dog(?!cat)