13-04-2006, 15:26
|
|
|
חבר מתאריך: 13.04.06
הודעות: 48
|
|
בעיה בREGEX להחלפת מילים בטקסט
קוד:
function paintViaSearch(){
myString = new String("Article9 1 text we Well we We ew Ew wellwellWelwe lwel Well we")
rExp = new RegExp("\\bwe*\\b");
newString = new String ("<span style='background:yellow'>we</span>")
results = myString.replace(rExp, newString)
document.getElementById("textTD").innerHTML = results;
}
שלום, אני מנסה להחליף את כל המילים "we" ברקע צהוב אבל הוא צובע לי רק את המילה הראשונה, כיצד אפשר שיצבע לי את כל המילים?
תודה רבה.
|