emposha / FCBKcomplete

Jquery facebook like(fancy) multi-select
http://www.emposha.com
383 stars 115 forks source link

special characters issue! #90

Open AimanZidan opened 12 years ago

AimanZidan commented 12 years ago

Hi,

Thanks for the great work!

Adding or typing an item with special character like the + symbol gives an error! and removing an item with special characters gives and error too

AimanZidan commented 12 years ago

I wrote this function

RegExp.escape = function(text) 
{
    return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
}

and I added it here, Now I can type a string with special characters, but I still get an error when I remove the item!

var regex = new RegExp((options.filter_begin ? '^' : '') + RegExp.escape(text), (options.filter_case ? "g": "gi"));

AimanZidan commented 12 years ago

And typing any string that contains ^% crash the plugin