Search API regex negative expression

Search API regex negative expression

penguinolpenguinol Posts: 5Questions: 3Answers: 0
edited December 2019 in Free community support

Edit: Just ran a search and found that it doesn't look like there is much support for regex with server-side processing.

Implementing Search API with regex using example: https://datatables.net/examples/api/regex.html

Initializing table with server side processing.

I'm trying to run negative searches using: ^((?!(SEARCHTERM)).)*$

This regex works as expected on the linked example above, but for some reason in my implementation returns nothing. Is this something to do with server side processing?

function filterGlobal () {
    $('#example').DataTable().search(
        $('#global_filter').val(),
        $('#global_regex').prop('checked'),
        $('#global_smart').prop('checked')
    ).draw();
}

function filterColumn ( i ) {
    $('#example').DataTable().column( i ).search(
        $('#col'+i+'_filter').val(),
        $('#col'+i+'_regex').prop('checked'),
        $('#col'+i+'_smart').prop('checked')
    ).draw();
}      

$(document).ready(function() {
    // DataTable
    $('#example').DataTable({
        "processing": true,
        "serverSide": true,
        "ajax": "server_processing.php"
        });

    $('input.global_filter').on( 'keyup click', function () {
        filterGlobal();
    } );

    $('input.column_filter').on( 'keyup click', function () {
        filterColumn( $(this).parents('tr').attr('data-column') );
    } );
} );

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598
    Answer ✓

    Edit: Just ran a search and found that it doesn't look like there is much support for regex with server-side processing.

    Yes, that's the case. This thread should help, it's asking the same thing.

    Cheers,

    Colin

This discussion has been closed.