Searching list of words not working on pdf viewer

PDF.js Express Version

Detailed description of issue
Error - Unhandled Promise rejection: TypeError: e.split is not a function

Expected behaviour
Should highlight all the words matching in the pdf.

Does your issue happen with every document, or just one?
{Answer here}

Link to document
{Provide a link to the document in question if possible}

Code snippet
let arr = [‘RAS’, ‘Cable’, ‘92780’]
var regexFromMyArray = new RegExp(arr.join("|"), ‘g’);
console.log(‘regex…’, regexFromMyArray)
instance.docViewer.setSearchHighlightColors({
searchResult: ‘rgba(0, 255, 0, 0.5)’,
activeSearchResult: ‘rgba(0, 255, 0, 0.5)’
});
instance.searchText(regexFromMyArray)

Hey there!

Sorry, I should have been a bit more specific in my last comment.

You’ll probably want to do something like this:

let arr = [‘RAS’, ‘Cable’, ‘92780’]
var regexFromMyArray = arr.join("|");

instance.docViewer.setSearchHighlightColors({
   searchResult: ‘rgba(0, 255, 0, 0.5)’,
   activeSearchResult: ‘rgba(0, 255, 0, 0.5)’
});
instance.searchTextFull(regexFromMyArray, { regex: true })

The things I changed here was using searchTextFull instead of just searchText, and using a string representation of the regex rather than an actual regex.

I hope this helps!

Thanks,
Logan