以下のコードの非常に奇妙な動作:
var showContent = document.getElementById("something"); // Search for a content
showContent = showContent.innerHTML;
var patt3=/Profile">[^<]*(?=<)/; // Search for this pattern ...
var showName=patt3.exec(showContent); // ... within the above found content
上記のshowNameの結果内の文字列を検索したいときに、問題が発生します。
var yesTest = showName.indexOf("text");
alert(yesTest);
上記は常に-1を返します(コンテンツが見つかりません)。しかし、これは
alert(showName);
明らかに「テキスト」が含まれています。私は何かが足りないのですか?