Skip to content

Commit

Permalink
Merge pull request #1411 from koenpunt/single-searchtext-replace
Browse files Browse the repository at this point in the history
Replace characters only once
  • Loading branch information
pfiller committed Jul 26, 2013
2 parents 5d22658 + f089884 commit a34ecd3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions coffee/lib/abstract-chosen.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ class AbstractChosen
results = 0

searchText = this.get_search_text()
escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")
regexAnchor = if @search_contains then "" else "^"
regex = new RegExp(regexAnchor + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i')
zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i')
regex = new RegExp(regexAnchor + escapedSearchText, 'i')
zregex = new RegExp(escapedSearchText, 'i')

for option in @results_data

Expand Down

0 comments on commit a34ecd3

Please sign in to comment.