bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Typeahead RegEx Escaping

Open seanli opened this issue 14 years ago • 1 comments

The typeahead widget will break when the input text contains characters required for regex matching (highlighting). Here is a code snippet for the escape function.

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

seanli avatar Mar 19 '12 18:03 seanli

this is fixed in 2.0.3 - thanks!

fat avatar Mar 25 '12 01:03 fat