title: Javascript - Replace substring if the substring is not prepended with a character Regex or other
body: <p>I need to replace all instances of a string(needle) within another string(haystack), but only where the needle is not preceeded by a specific character, in this case '-'</p>
  <pre class="lang-js prettyprint-override"><code>
  var needle = 'secret';
  var haystack = 'secret title date user -secret secret something.secret';
  
  //Regex that needs to be adjusted
  var result = haystack.replace(/secret/g, '');
  
  //Desired result is
  var desiredResult = ' title date user -secret  something.';
  
  </code></pre>