title: When does Javascript "initialize" a RegEx pattern?
body: <p>I take care to declare a RegEx pattern once and reuse if possible, for performance reasons. I'm not entirely certain why - something I probably read once many years ago and has been filed away in the ol' skull sponge. </p>
  
  <p>I find myself in a regex-heavy situation, and a thought occurred... does declaring a RegEx pattern "instantiate" or "initialize" that pattern, or does it just store the pattern until it's needed?</p>
  
  <pre><code>var NonNumbers = /[^0-9]/g; //"initialized" here?
  "h5u4i15h1iu".replace(NonNumbers, "*"); //or "initialized" here?
  </code></pre>
  
  <p>Maybe <code>RegExp()</code> actually creates one and the literal waits until it's used, even though both patterns return the same results? </p>
  
  <pre><code>var NonNumbers = /[^0-9]/g; //just stores the pattern
  var NonNumbers = RegExp(/[^0-9]/, 'g'); //actually creates the RegExp
  </code></pre>
  
  <p>Just an itch I'm hoping someone who understands the inner workings can scratch. </p>