findAndReplaceDOMText icon indicating copy to clipboard operation
findAndReplaceDOMText copied to clipboard

Matches gone after replacement

Open chiluap opened this issue 7 years ago • 0 comments

Hi James, I was wondering, is it possible to see what strings in the DOM matched the find: RegExp? I am using the following options and would like to know which strings where matched.

var searchConfig = {
            find: new RegExp(pool.searchText, 'g'),
            wrap: wType || 'span',
            wrapClass: wClass || 'filter-number',
 };
var finder = findAndReplaceDOMText(domElement, searchConfig);

Since the matches are popped finder.matches is empty after execution. Is there a way to seperate find and wrap function calls to extract the matches in beween?

If not I could implement some 'persistentMatches: true' flag that would write the matches into this.persistentMatches or so?

Keep up the awsome work.

Thank you

Christian

chiluap avatar Jan 31 '18 10:01 chiluap