This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Escape all RegEx reserved characters from string | |
function escRegExp(str) { | |
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); | |
} | |
// Return matched elements based on regex contents | |
function highlight(regex, element, child) { | |
// Create a regex based on the match string | |
var regex = new RegExp(escRegExp(regex), 'gim'); | |
// Generate results based on regex matches within match_parent |