0

別の文字列の先頭で文字列を検索すると、これで問題なく動作します。

       if ($(this).text().search(new RegExp(filter, "i")) < 0) { ...

2 番目の単語 (コンマに続く) も検索したいのですが、次の単語はヒットを返しません。

findcomma = ($(this).text().indexOf(",")+1); // plus 1 to ignore comma itself
    if ($(this).text().substring(findcomma,$(this).text().length).search(new RegExp(filter, "i")) < 0) { ...

2 番目の If ステートメントのヘルプをいただければ幸いです。

4

1 に答える 1

0

括弧が一致していないと思います()。if 条件を次のように書き換えるだけです。

if (($(this).text().substring(findcomma,$(this).text().length)).search(new RegExp(filter, "i")) < 0) 
于 2013-04-16T09:11:20.807 に答える