PDA

View Full Version : Replacing Not Operating in Opera Correctly


Kenji Miyamoto
07-23-2005, 08:12 AM
The following code replaces all instances of <story class title></story> and <story title class></story> in both Firefox and Konqueror, but not in Opera:function storyDiv(inp) {
var mid = inp.replace(/<story class=\"(h|n|s)\" title=\"(.*?)\">((\n|.)*?)<\/story>/g, "<div class=\"story\$1\" xml:lang=\"en-US\" title=\"\$2\">\n <h3 class=\"sTitle\">\$2</h3>\n <div class=\"storyData\">\$3</div>\n </div>");

var out = mid.replace(/<story title=\"(.*?)\" class=\"(h|n|s)\">((\n|.)*?)<\/story>/g, "<div class=\"story\$2\" xml:lang=\"en-US\" title=\"\$1\">\n <h3 class=\"sTitle\">\$2</h3>\n <div class=\"storyData\">\$3</div>\n </div>");

return out;
}What doesn't Opera support in this function?

Kor
07-25-2005, 08:39 AM
why not use DOM methods to replace a childNode? And I am not sure that return out is valid ECMA...