Need to escape a special character in a jQuery selector string
<p>According to <a href="http://api.jquery.com/category/selectors/">the selectors docs</a>, you must escape <code>[</code> with double backslash, etc <code>\\[</code>.</p>

<p>I have a selector that is created like so (assume <code>val</code> attribute is <code>something[4][2]</code> in this example).</p>

<pre><code>var val = $(this).attr('val');           

$select.find('option[value=' +  val + ']').show();
</code></pre>

<p>Can I write a regex to escape the brackets for me?</p>
