title: JavaScript RegExp to match a given string only if it is not surrounded by brackets
body: <p>I am looking for a JavaScript regular expression that would match the word "foo" in a phrase <code>"This &lt;is foo"</code> or <code>"This is foo"</code> or <code>"This is foo&gt;"</code> but would not match in the phrase <code>"This &lt;is foo&gt;"</code>. I know that in other languages this is solved by using negative lookbehinds, but AFAIK, JavaScript does not support these. I have come across similar questions, but none of them matched exactly what I am looking for, and I can't think of a solution on my own. I would be grateful for any hint. </p>
  
  <p>I am testing my attempts <a href="http://www.regexpal.com/" rel="nofollow noreferrer">here</a>.</p>