I don’t know enough to change the following so that it only puts <strong> around the first found string matching the term:
highlight: function(value, term) { return value.replace(new RegExp('(?![^&;]+;)(?!<[^<>]*)(' + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\]){1}/gi, '\\$1') + ')(?![^<>]*>)(?![^&;]+;)', 'gi'), '<strong>$1</strong>'); }
This is from the jQuery autocomplete plugin: http://docs.jquery.com/Plugins/Autocomplete or http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/
By default if you type ‘a’ in the field, the the following results would look like ‘Apple Ate Ants’ and I only want ‘Apple Ate Ants’.
Try changing the last ‘gi’ to ‘i’ (the ‘g’ tells it to replace all matches).