hi all, i encountered a problem when using js replace.
I wanna get the value of an attritbute from xml by using the following
code,
var str = 'id="1" type="1" cn="" disc="sdfgdsgdgsdg">';
var Attribute = "id";
var Attr = new RegExp(".*" + Attribute + '="([^"]*)".*>');
alert(str.replace(Attr, "$1"));
it works fine, the message dialog shows "1".
but if the str contain "\r\n",
var str = 'id="1" type="1" cn="" disc="sdfgdsgdgsdg\r\n">';
var Attribute = "id";
var Attr = new RegExp(".*" + Attribute + '="([^"]*)".*>');
alert(str.replace(Attr, "$1"));
then the message dialog shows whole original str.
Can anyone give me some advice?