-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
function highlight(str, term) {
--------------------------------- ADDED CHANGES ----------------------------------------------------------
term = term.replace(/^\s+|\s+$/g, '') //replace trailing spaces
term = term.replace(/\s\s+/g, '|') //replace all spaces, tabs, newlines by | => regex OR,
//instead of using "term" as a single word
var highlight_regex = new RegExp('(' + term + ')', 'gi');
return str.replace(highlight_regex,
'<span class="highlight">$1</span>');
};
Metadata
Metadata
Assignees
Labels
No labels