If you are using the API you can just pass 'null' as the second parameter to fnFilter ( http://datatables.net/api#fnFilter ). Or if you want it on the default global filter you can use oTable.fnSettings().oPreviousSearch.bEscapeRegex = false;
But I have found a problem. I would like to use only global filter and I would like to use regex in it. But in _fnFilter where you generate the regular expression to use you break it apart and then combine it in a way the most useful regex does not work, "^prefix" for example, as you make out of it "^(?=.*?^prefix).*$", what does not really work as expected. (In comment about you also mention \b in regex but you do not use it later in code to generate regex.)
Yes indeed, DataTables tries to be "clever" to make it's default filter as versatile as possible for casual implementation. But as you are seeing, this can interfere with custom complex regular expressions. In order to do this kind of filtering you'll need to make use of one of the APIs that DataTables presents - a custom global filter: http://datatables.net/development/filtering . It might not be quite as easy are the standard global filter, but it is massively more flexible.
Replies
If you are using the API you can just pass 'null' as the second parameter to fnFilter ( http://datatables.net/api#fnFilter ). Or if you want it on the default global filter you can use oTable.fnSettings().oPreviousSearch.bEscapeRegex = false;
Regards,
Allan
[code]
$('#table').dataTable(... settings ...).fnSettings().oPreviousSearch.bEscapeRegex = false;
[/code]
Actually it is possible through the initialisation object. You can use oSearch which is an object which takes two parameters bEscapeRegex and sSearch.
Regards,
Allan
But I have found a problem. I would like to use only global filter and I would like to use regex in it. But in _fnFilter where you generate the regular expression to use you break it apart and then combine it in a way the most useful regex does not work, "^prefix" for example, as you make out of it "^(?=.*?^prefix).*$", what does not really work as expected. (In comment about you also mention \b in regex but you do not use it later in code to generate regex.)
Yes indeed, DataTables tries to be "clever" to make it's default filter as versatile as possible for casual implementation. But as you are seeing, this can interfere with custom complex regular expressions. In order to do this kind of filtering you'll need to make use of one of the APIs that DataTables presents - a custom global filter: http://datatables.net/development/filtering . It might not be quite as easy are the standard global filter, but it is massively more flexible.
Hope the helps,
Allan