Skip to content

Commit

Permalink
feat(search): non greedy regexp match
Browse files Browse the repository at this point in the history
  • Loading branch information
lubber-de committed Dec 14, 2023
1 parent 35fe604 commit e601bc8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/definitions/modules/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@
var querySplit = query.split(''),
diacriticReg = settings.ignoreDiacritics ? '[\u0300-\u036F]?' : '',
htmlReg = '(?![^<]*>)',
markedRegExp = new RegExp(htmlReg + '(' + querySplit.join(diacriticReg + ')(.*)' + htmlReg +'(') + diacriticReg + ')', regExpIgnore),
markedRegExp = new RegExp(htmlReg + '(' + querySplit.join(diacriticReg + ')(.*?)' + htmlReg +'(') + diacriticReg + ')', regExpIgnore),

Check failure on line 952 in src/definitions/modules/dropdown.js

View workflow job for this annotation

GitHub Actions / Lint

Operator '+' must be spaced
markedReplacer = function(){

Check failure on line 953 in src/definitions/modules/dropdown.js

View workflow job for this annotation

GitHub Actions / Lint

Missing space before function parentheses

Check failure on line 953 in src/definitions/modules/dropdown.js

View workflow job for this annotation

GitHub Actions / Lint

Missing space before opening brace
var args = [].slice.call(arguments,1, querySplit.length * 2).map(function(x, i){

Check failure on line 954 in src/definitions/modules/dropdown.js

View workflow job for this annotation

GitHub Actions / Lint

A space is required after ','

Check failure on line 954 in src/definitions/modules/dropdown.js

View workflow job for this annotation

GitHub Actions / Lint

Missing space before function parentheses

Check failure on line 954 in src/definitions/modules/dropdown.js

View workflow job for this annotation

GitHub Actions / Lint

Missing space before opening brace
return i & 1 ? x : '<mark>' + x + '</mark>'})

Check failure on line 955 in src/definitions/modules/dropdown.js

View workflow job for this annotation

GitHub Actions / Lint

Unexpected use of '&'

Check failure on line 955 in src/definitions/modules/dropdown.js

View workflow job for this annotation

GitHub Actions / Lint

Requires a space before '}'

Check failure on line 955 in src/definitions/modules/dropdown.js

View workflow job for this annotation

GitHub Actions / Lint

Closing curly brace should be on the same line as opening curly brace or on the line after the previous block

Check failure on line 955 in src/definitions/modules/dropdown.js

View workflow job for this annotation

GitHub Actions / Lint

Missing semicolon
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/modules/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@
querySplit = module.get.value().split(''),
diacriticReg = settings.ignoreDiacritics ? '[\u0300-\u036F]?' : '',
htmlReg = '(?![^<]*>)',
markedRegExp = new RegExp(htmlReg + '(' + querySplit.join(diacriticReg + ')(.*)' + htmlReg +'(') + diacriticReg + ')', regExpIgnore),
markedRegExp = new RegExp(htmlReg + '(' + querySplit.join(diacriticReg + ')(.*?)' + htmlReg +'(') + diacriticReg + ')', regExpIgnore),
markedReplacer = function(){
var args = [].slice.call(arguments,1, querySplit.length * 2).map(function(x, i){
return i & 1 ? x : '<mark>' + x + '</mark>'})
Expand Down

0 comments on commit e601bc8

Please sign in to comment.