Autocomplete: Updated escapeRegex utility based on http://xregexp.com/xregexp.js

This commit is contained in:
jzaefferer 2010-07-05 10:05:00 +02:00
parent 7d24c1a57f
commit 0bbbe5f5b1

View File

@ -316,7 +316,7 @@ $.widget( "ui.autocomplete", {
$.extend( $.ui.autocomplete, {
escapeRegex: function( value ) {
return value.replace( /([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1" );
return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
},
filter: function(array, term) {
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );