Permalink
Browse files

Fixed issue #10 with regular expression special chars not being escap…

…ed properly
  • Loading branch information...
thanosp committed Feb 22, 2012
1 parent 2e8734a commit c198c21c55d64b7b7858975c397062ef59e984e2
Showing with 1 addition and 1 deletion.
  1. +1 −1 jquery.awesomecomplete.js
@@ -212,7 +212,7 @@
if (terms[j] === '')
continue;
- terms[j] = terms[j].replace(/[\\*+?|{}()^$.#]/g, '\\$1');
+ terms[j] = terms[j].replace(/([\\*+?|{}()^$.#])/g, '\\$1');

This comment has been minimized.

Show comment Hide comment
@sandro

sandro Aug 9, 2012

What about brackets []?

I've had good luck with replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&')

@sandro

sandro Aug 9, 2012

What about brackets []?

I've had good luck with replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&')

var regex = new RegExp('(' + terms[j] + ')', (config.ignoreCase ? 'ig' : 'g'));
var matches = [];

0 comments on commit c198c21

Please sign in to comment.