title: Jquery autocomplete combobox\category - search optgroup labels
body: <p>Sort of building on a question i asked earlier <a href="https://stackoverflow.com/questions/11039814/jquery-ui-autocomplete-combobox-with-categories">here</a></p>
  
  <p>I'm using the jquery ui autocomplete to create a autocomplete form.  With your help i've successfully combined the combobox and category options of it together.  Now after thinking i'm trying to take it yet another level.</p>
  
  <p>What I would like to do is be able to have the combobox also search optgroup labels as well as the option text.  If the text matched the optgroup label the whole category would show, but it would still would search on the option text as well.</p>
  
  <p>I'm guessing the edits need to happen in the block below.</p>
  
  <pre><code> response(select.find("option").map(function() {
                      var text = $(this).text();
                      if (this.value &amp;&amp; (!request.term || matcher.test(text))) return {
                          label: text.replace(
                          new RegExp("(?![^&amp;;]+;)(?!&lt;[^&lt;&gt;]*)(" + $.ui.autocomplete.escapeRegex(request.term) + ")(?![^&lt;&gt;]*&gt;)(?![^&amp;;]+;)", "gi"), "&lt;strong&gt;$1&lt;/strong&gt;"),
                          value: text,
                          option: this,
                          category: $(this).closest("optgroup").attr("label")
                      };              
                  }).get());
  </code></pre>
  
  <p><a href="http://jsfiddle.net/gB32r/" rel="nofollow noreferrer">jsfiddle</a></p>