mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-10-08 13:44:18 +00:00
Filter: partially revert df1afccdda
(see #1505)
Automatic escaping of RegExp special characters must be done manually as already explained in the documentation
This commit is contained in:
parent
18410a3888
commit
25eb3f1856
@ -816,6 +816,7 @@ $.extend($.tablesorter.language, {
|
||||
<h3>Notes</h3>
|
||||
<ul>
|
||||
<li><span class="label label-info">Info</span> These changes still require the user to enter spaces in the filter to perform the search, e.g. <code>1 à 10</code> (shows rows with numbers between 1 and 10).</li>
|
||||
<li><span class="label label-info">Info</span> Extra spaces around the value will be trimmed and it is valid to set a value to an empty string; but this won't disable the filter type (use `-` for "to", `|` for "or" and "&&" for "and").</li>
|
||||
<li>
|
||||
<span class="label warning">Warning</span> These language values are added to a regular expression using <code>new RegExp()</code>:
|
||||
<ul>
|
||||
|
@ -368,8 +368,8 @@
|
||||
var options, string, txt, $header, column, val, fxn, noSelect,
|
||||
c = table.config,
|
||||
wo = c.widgetOptions,
|
||||
escRegExp = function(prefix, str, suffix) {
|
||||
str = str.trim().replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
processStr = function(prefix, str, suffix) {
|
||||
str = str.trim();
|
||||
// don't include prefix/suffix if str is empty
|
||||
return str === '' ? '' : (prefix || '') + str + (suffix || '');
|
||||
};
|
||||
@ -388,13 +388,13 @@
|
||||
$.extend( tsfRegex, {
|
||||
child : new RegExp( c.cssChildRow ),
|
||||
filtered : new RegExp( wo.filter_filteredRow ),
|
||||
alreadyFiltered : new RegExp( '(\\s+(-' + escRegExp('|', ts.language.or) + escRegExp('|', ts.language.to) + ')\\s+)', 'i' ),
|
||||
toTest : new RegExp( '\\s+(-' + escRegExp('|', ts.language.to) + ')\\s+', 'i' ),
|
||||
toSplit : new RegExp( '(?:\\s+(?:-' + escRegExp('|', ts.language.to) + ')\\s+)', 'gi' ),
|
||||
andTest : new RegExp( '\\s+(' + escRegExp('', ts.language.and, '|') + '&&)\\s+', 'i' ),
|
||||
andSplit : new RegExp( '(?:\\s+(?:' + escRegExp('', ts.language.and, '|') + '&&)\\s+)', 'gi' ),
|
||||
orTest : new RegExp( '(\\|' + escRegExp('|\\s+', ts.language.or, '\\s+') + ')', 'i' ),
|
||||
orSplit : new RegExp( '(?:\\|' + escRegExp('|\\s+(?:', ts.language.or, ')\\s+') + ')', 'gi' ),
|
||||
alreadyFiltered : new RegExp( '(\\s+(-' + processStr('|', ts.language.or) + processStr('|', ts.language.to) + ')\\s+)', 'i' ),
|
||||
toTest : new RegExp( '\\s+(-' + processStr('|', ts.language.to) + ')\\s+', 'i' ),
|
||||
toSplit : new RegExp( '(?:\\s+(?:-' + processStr('|', ts.language.to) + ')\\s+)', 'gi' ),
|
||||
andTest : new RegExp( '\\s+(' + processStr('', ts.language.and, '|') + '&&)\\s+', 'i' ),
|
||||
andSplit : new RegExp( '(?:\\s+(?:' + processStr('', ts.language.and, '|') + '&&)\\s+)', 'gi' ),
|
||||
orTest : new RegExp( '(\\|' + processStr('|\\s+', ts.language.or, '\\s+') + ')', 'i' ),
|
||||
orSplit : new RegExp( '(?:\\|' + processStr('|\\s+(?:', ts.language.or, ')\\s+') + ')', 'gi' ),
|
||||
iQuery : new RegExp( val, 'i' ),
|
||||
igQuery : new RegExp( val, 'ig' ),
|
||||
operTest : /^[<>]=?/,
|
||||
|
Loading…
Reference in New Issue
Block a user