Ignore markup while searching
blessanm86 opened this issue · comments
I noticed that package would mess up a string if I pass in text that has markup in it. I needed it to ignore anchor tags, so that it would not mess up the href.
I was able to solve it by modifying the findChunks
method
from
var regex = new RegExp(searchWord, 'gi');
to
var regex = new RegExp('('+searchWord+')(?![^<]*>)', 'gi');
Would this be something you want to include in this package? Right now im using my own fork.
I could submit a PR for this.
Hey @Blessenm,
Thanks for opening this issue for discussion. As I mentioned in bvaughn/react-highlight-words/issues/15, this is a bit outside of my intended scope for these projects, so I'm going to close this issue. Feel free to fork though- no hard feelings on this side. 😄 Thanks for understanding!