[Javascript] Re: [Javascript] Replace

Luis Sánchez a19992517 at pucp.edu.pe
Thu Jan 16 17:02:09 CST 2003


I think you must use the \"replace\" function.
Create a HTML file with this code to see it:

<HTML>
<HEAD>
<TITLE> Corrector </TITLE>
<script>
function corrige(texto,reemplazo){
	var a = texto.replace(/[\\n\\r\"]/g,reemplazo);
	return a;
}
</script>
</HEAD>
<BODY>
<form name=\"form\" onsubmit=\"alert(corrige(this.texto.value,\'\'));return false\">
<TEXTAREA TYPE=\"text\" name=\"texto\"></TEXTAREA>
<input type=\"submit\" value=\"show it corrected\">
</form>
</BODY>
</HTML>

Write something. The replace function I\'m using will replace all the quotes (\"),
carrige returns (\\r) and line feeds (\\n).

Regular expressions are very useful.

http://developer.netscape.com/docs/manuals/js/client/jsguide/regexp.htm

LUIS SANCHEZ

------ Mensaje original -------
De : THerman at jerviswebb.com
Para : javascript at LaTech.edu
Fecha : Thu, 16 Jan 2003 13:58:44 -0500
Asunto : [Javascript] Replace
>Hello
>can someone direct me to a replace function that takes care of quotes,
>carrige returns , line feeds
>
>thanks
>terry
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
>         


More information about the Javascript mailing list