Testing for equality of regular expressions
<p>I was surprised to see that </p>

<pre><code>/a/ === /a/
</code></pre>

<p>evaluates to <code>false</code> in JavaScript. Reading through <a href="http://ecma-international.org/ecma-262/5.1/?utm_source=javascriptweekly&amp;utm_medium=email#sec-7.8.5" rel="nofollow">the specs</a>:</p>

<blockquote>
  <p>Two regular expression literals in a program evaluate to regular
  expression objects that never compare as === to each other even if the
  two literals' contents are identical.</p>
</blockquote>

<p>Since <code>===</code> cannot be used to test for equality, how can equality of regular expressions be tested in JavaScript?</p>
