1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
<script type="text/javascript">
function chercheRemplace(text, ToFind, Remplacement){
//Récupération des infos
var text = text.toString();
var maReg = new RegExp(ToFind, "gi");
var resultat = text.replace(maReg, Remplacement);
if (text.search(maReg) == -1) alert("Expression non trouvée");
else alert(resultat);
}
varleur1 = "toto";
var WStr= varleur1 + "\r\n" + "\r\n" + varleur1 + "\r\n" + "\r\n" + varleur1 + "\r\n" + "\r\n" + varleur1;
chercheRemplace(WStr,"\r\n","\r\n\r\n","aucun");
</script> |