使用 tablesorter 将通配符搜索到固定长度的可能语法
possible syntax to search wildcard to fixed length with tablesorter
使用 tablesorter 是否可以使用通配符搜索固定长度的列?
即具有以下
aa
aaa
aaaa
ab
aba
abaa
是否有像 =a?
这样的语法,只有 return
aa
ab
感谢艺术
当您在过滤器小部件中使用 ?
字符时,它实际上是将 ?
替换为 \S{1}
。用于搜索该列的正则表达式变为 /a\S{1}/
,它会找到 aaaa
,因为有两个单独的匹配项 a?
(RegExr demo).
过滤器小部件将接受正则表达式。要获得您想要的精确匹配,您需要使用单词边界锚点 (\b
) 并围绕值(/\ba\S\b/
或 /\ba.\b/
)(regExr demo) .
Here is a tablesorter demo
// this example will only target the first column
$('table').trigger('search', [[ "/\ba\S\b/" ]]);
使用 tablesorter 是否可以使用通配符搜索固定长度的列?
即具有以下
aa
aaa
aaaa
ab
aba
abaa
是否有像 =a?
这样的语法,只有 return
aa
ab
感谢艺术
当您在过滤器小部件中使用 ?
字符时,它实际上是将 ?
替换为 \S{1}
。用于搜索该列的正则表达式变为 /a\S{1}/
,它会找到 aaaa
,因为有两个单独的匹配项 a?
(RegExr demo).
过滤器小部件将接受正则表达式。要获得您想要的精确匹配,您需要使用单词边界锚点 (\b
) 并围绕值(/\ba\S\b/
或 /\ba.\b/
)(regExr demo) .
Here is a tablesorter demo
// this example will only target the first column
$('table').trigger('search', [[ "/\ba\S\b/" ]]);