Regex and server-side processing not really working
Regex and server-side processing not really working
Hello,
I have a column filled with numerical values and could not get any valid response when searching using regular expressions.
For example: this one is working excellent when searching for '3', but returning as well all the rows containing '3' (like '33', '36', '39')
var select = $('SELECT_OPTIONS')
.appendTo( $(this).empty() ).on( 'change', function () {table.column( idx ).search( $(this).val(), true, false ).draw();});
so instead I want to use a simple regex like
var select = $('SELECT_OPTIONS')
.appendTo( $(this).empty() ).on( 'change', function () {table.column( idx ).search( '^' + $(this).val() + '$', true, false ).draw();});
Data is send correctly to the server, no errors in console.
May be somebody had a similar situation or issue.
Thank you.
This question has an accepted answers - jump to answer
Answers
Anyone please...
If you want exact matching, just remove the
LIKE %%
in the code since that is what is doing the partial matching (assuming you are using the provided PHP libraries).Allan
Thank you, Allan for pointing to the right direction.
I'm using provided PHP libraries, but I need a partial match as well, so... this one is working just fine: