我有一个代表一段文本的字符串。
var paragraph = "It is important that the word cold is not partially selected where we search for the word old";
我希望能够在本段中搜索“单词”的索引,并让它对“单词”进行完全匹配。例如,在搜索“旧”时。我应该只得到 1 个结果,而不是 2 个,因为匹配“冷”中的“旧”是无效的。
我有一个代表一段文本的字符串。
var paragraph = "It is important that the word cold is not partially selected where we search for the word old";
我希望能够在本段中搜索“单词”的索引,并让它对“单词”进行完全匹配。例如,在搜索“旧”时。我应该只得到 1 个结果,而不是 2 个,因为匹配“冷”中的“旧”是无效的。