javascript - Highlight a word from a URL -


i new angularjs.so, here have requirement have highlight words html document.suppose it's resume in html format.so, have array of words html document need highlight. so, able highlight words except words in url. e.g. in document the

http://www.example.com  

so here want highlight word example .

my highlight method -

$scope.highlighthtml = function (content, text, classname, notbywordboundry) {     var regexpescapetext, str;     if (!(content && content.replace)) {         return '';     }     if (!text) {         return $sce.trustashtml(content);     }     if (!classname) {         classname = 'mark';     }     regexpescapetext = text.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");     if (!notbywordboundry) {          str = new regexp('(\\b)' + regexpescapetext + '(\\b)', 'gi');     } else {          str = new regexp(regexpescapetext, 'gi');     }     return content.replace(str, '<span tabindex="1" class="' + classname + '">$&</span>'); }; 

at time messing html file while trying highlight word link or url . how can resolve ?


Comments