Javascript 若字符串有双引号,则Jquery数据表搜索行为不正确;中间

Javascript 若字符串有双引号,则Jquery数据表搜索行为不正确;中间,javascript,jquery,datatable,datatables,Javascript,Jquery,Datatable,Datatables,我使用jquery.datatable.js并使用datatable的默认智能搜索 var dataTable=$('#task_table').DataTable( { deferRender:true, destroy:true, scrollCollapse: true, select:'multi', rowId:'_id', scroller:true, scroll

我使用jquery.datatable.js并使用datatable的默认智能搜索

    var dataTable=$('#task_table').DataTable( {
        deferRender:true,
        destroy:true,
        scrollCollapse: true,
        select:'multi',
        rowId:'_id',
        scroller:true,
        scrollY:"0px",
        bInfo:false,
        bLengthChange:false,
        columns:self.getColumns(),
        fnDrawCallback:function(){
        }
    } );
    $('#Search').on( 'keyup', function(){
        dataTable.search(this.value).draw();
    });
我正在使用上面的代码进行搜索 下面是我在搜索中使用的字符串示例

使用dataTable.search(this.value).draw();这不会同时搜索我提到的字符串

使用后

dataTable.search('"'+ this.value +'"').draw();
  • =calc|a!z'ss“s:s
    :工作正常
  • !“abc'aa”广告#$%k“as'”
    :不搜索
    !“abc'aa”
    字符串的这部分

  • 有人可以帮助搜索datatable中的任何字符串吗?在搜索之前,可以对变量中的特殊字符进行转义

    .replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g,'\\$1') + "']"
    

    不工作尝试了此.value.replace(/([#&,.+*~\':“!^$[]()=>\/@])/g,“\\$1')+”]“如果输入的值已更改!“abc'aa”广告#$%k“作为”这些类型的值,或在tablevar str=“abc的测试”中;警报(str.replace(/[^a-zA-Z]/g,”);此返回--abcs testsno i want/([#&,.+*~\':“!此待搜索替换将消除”