title: Highlight jQuery UI autocomplete
body: <p>I'm using the autocomplete function in jQuery UI 1.8.6. And I want to highlight matching results. But for some reason when I use a regex to add "strong" tags around the matching characters, the string is being escaped. So I see <code>[strong]matching chars[/strong]</code>, instead of marked up text.</p>
  
  <p>This is the javascript I'm currently using:</p>
  
  <pre><code>$("#autocompleteinputfield").autocomplete({
      source: function (request, response) {
          $.ajax({
              url: "someservice",
              type: "GET",
              dataType: "json",
              data: { filter: request.term, maxResults: 10 },
              success: function (data) {
                  response($.map(data, function (item) {
                      // return { label: item.ID + ' - ' + item.Name, id: item.ID, value: item.Name }
                      var regex = new RegExp("(?![^&amp;;]+;)(?!&lt;[^&lt;&gt;]*)(" + request.term.replace(/ ([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/ gi, "\\$1") + ")(?![^&lt;&gt;]*&gt;)(?![^&amp;;]+;)", "gi");
  
                      return {
                          label: (item.ID + ' - ' + item.Name).replace(regex, "&lt;strong&gt;$1&lt;/strong&gt;"),
                          id: item.ID,
                          value: item.Name
                      }
  
                  }))
              }
          });
      },
      select: function (event, ui) {
          alert(ui.item ? ("You picked '" + ui.item.label + "' with an ID of " + ui.item.id)
              : "Nothing selected, input was " + this.value);
      }
  });
  </code></pre>
  
  <p>Update : </p>
  
  <p>"Input" is the text entered in a textbox (in this case : <code>[input type="text" id="autocompleteinputfield" /]</code></p>
  
  <p>Output looks like this:</p>
  
  <pre><code>[{"Description":"Nothing meaningful","ID":3,"Name":"Joe Public‎"}]
  </code></pre>