title: javascript unterminated character class
body: <pre><code>var badCode = "\(INST1,\\[0,";
  var regex = new RegExp(badCode, "igm");
  </code></pre>
  
  <p>gets "unterminated character class" error.</p>
  
  <p>How to fix?</p>
  
  <p>TIA</p>
  
  <p>trying suggestions from responders to this post, please see the following screen prints (you might have to right-click on images and open in new tab to make legible):
  note values of new_bad_thing (equiv of badCode above)
  <img src="https://i.stack.imgur.com/h5vPY.png" alt=""></p>
  
  <p>and here is the screen print when I hit the run button (please note the error message):</p>
  
  <p><img src="https://i.stack.imgur.com/NnrTi.png" alt="enter image description here"></p>