我正在使用这个功能来帮助我的网络开发人员在网页中找到一段代码:
function findString (str) {
var strFound;
strFound=self.find(str);
if (strFound && self.getSelection && !self.getSelection().anchorNode ){
strFound=self.find(str);
}
if (!strFound) {
strFound=self.find(str,1,1)
while (self.find(str,1,1)) continue
}
}
问题是当我输入以下字符串时:
array[1]
它找不到它!这很奇怪,因为我尝试了这个函数,它可以找到任何其他字符串。那么,如何使用此函数查找包含方括号的字符串(如果可能,不使用正则表达式)?
谢谢,
问候