I need to search a specific column in a DataTable for such a large number of terms that the table.search()
using regex doesn’t work. All of my search terms will either match exactly or not at all. Is there a way search a table for tens of thousands of terms that would lead to a regex of hundreds of thousands of characters?
In this answer, for example, the datatable search terms were formed into a regular expression searchString
and then the table was filtered using table.search()
. But when my regex pattern is too large, I get this error:
Warning in grep(pattern, "", perl = TRUE) :
PCRE pattern compilation error
'regular expression is too large'
at ''
Several people on the datatables forum wrote (e.g.) that the solution to this problem is to implement a custom search plug-in.
However, it appears that this is only possible by configuring a DataTable during initialization from JavaScript, and my DataTable is initialized by its R API: https://datatables.net/plug-ins/filtering/