regex - jquery - replace matched character -
i want replace comma followed < br > used regex et replace method that:
var str = "<a class=added> ,,, ,, blbl;test, </a><br>, <a class=added>" str = str.replace(/br>(,\s)/g, " "); alert(str);
in result noticed 'br>' removed , not exected result. there wrong regex?
"<a class=added> ,,, ,, blbl;test, </a>< <a class=added>"
you doing regex match correctly not replacing correctly. should replace string:
"br> "
as follows:
>>> str = str.replace(/br>(,\s)/g, "br> "); "<a class=added> ,,, ,, blbl;test, </a><br> <a class=added>"
Comments
Post a Comment