title: How to count or replace all matching words between { } or [ ] in javascript with regex?
body: <p>I need to process a file with may sentences in javascript. And there are some special sentences that are wrapped in brackets [ ] or { }. And between this brackets the word can occure multiple times. So to find a word at all I tried first:</p>
  
  <pre><code>RegExp('\\bmyword\\b', 'g');
  </code></pre>
  
  <p>But how do I insert that the words need to be inside the brackets and that anything can be between the brackets and words?
  And if I'm looking for 500 words in about 10k sentences, how can I speed it up? Should I then use pattern?</p>