I am encountering an issue where my regular expression is not properly searching for specific column data in datatables. I want it to only return exact matches with the format word dot word (e.g. John.smith), but currently, it also works with just one word (e.g. it will display results for "John" as well). Any suggestions on how to fix this would be greatly appreciated.
initComplete: function () {
// Apply the search
this.api().columns(8).every( function () {
var that = this;
$( 'input', this.footer() ).on( 'keyup change clear', function () {
if ( that.search() !== this.value ) {
var searchTerm = this.value.toLowerCase(),
regex = '\\b' + searchTerm + '\\b';
that
.search( regex, true, false )
.draw();
}
} );
} );
}
Thank you in advance.