我正在寻找一些插件/脚本,搜索一些字符串和粗体匹配部分(模糊搜索)
在parent > key > result example下面。
"Hello world“=>”Hello“=> Hello world
"Hello world“=> "hewd”=> Hello world
我发现了this -它有模糊的选项,但它不能粗体匹配字符串的一部分或多部分。
你知道像这样的插件吗。
发布于 2013-09-03 03:29:56
一个简单的例子:
$('element').html(function() {
return $(this).text().replace(/[hewd]/gi, '<strong>$&</strong>');
});然后,您可以通过构建动态正则表达式来对其进行抽象。上面的代码可以匹配任何一个单词,如果你想匹配整个单词,你可以使用h,e,w,d \b
/\bhello\b|[ewd]/ //=> Will match "hello" and all "e,w,d" lettershttps://stackoverflow.com/questions/18579539
复制相似问题