[Javascript] RegExp
FRANCESC ESCOFET
fescofet at datadec.es
Wed Oct 10 04:49:58 CDT 2001
try this:
var strString;
strString = myform.mytextarea.value;
re = /\n/gi;
strString = strString.replace(re,"");
alert(strString);
> -----Mensaje original-----
> De: .ben [SMTP:ben at babelfish.co.uk]
> Enviado el: miércoles 10 de octubre de 2001 11:46
> Para: FRANCESC ESCOFET; ANTONIO PEREZ; ANTONIO TORTOLA
> Asunto: Re: [Javascript] RegExp
>
> Hmm. I can't get it to work. Let me show you my code, if I may:
>
> ----- 8< -----
> <script language="javascript">
> function replaceText()
> {
> var strString;
>
> strString = myform.mytextarea.value;
>
> strString.replace(/\n/,'')
>
> alert(strString);
>
> myform.mytextarea.value = strString;
> }
> </script>
> ----- >8 -----
>
> Any ideas?
>
> Cheers,
>
> .ben
>
> ----- Original Message -----
> From: "Mikael Lindström" <mikael.lindstrom at nipsoft.se>
> To: <javascript at LaTech.edu>
> Sent: Wednesday, October 10, 2001 10:12 AM
> Subject: RE: [Javascript] RegExp
>
>
> > No,
> >
> > more something like
> >
> > strFarHang.replace(/\n/,'')
> >
> > /Mikael
> >
> > > -----Original Message-----
> > > From: javascript-admin at LaTech.edu
> > > [mailto:javascript-admin at LaTech.edu]On
> > > Behalf Of .ben
> > > Sent: Wednesday, October 10, 2001 11:01 AM
> > > To: JavaScript Mailing List
> > > Subject: [Javascript] RegExp
> > >
> > >
> > > Hi all.
> > >
> > > I'm trying to use the string.replace() function to replace
> > > all the CrLf's
> > > (new line) in a block of text with nothing, i.e. remove all
> > > line formatting.
> > >
> > > I was thinking I could do this:
> > >
> > > strFarHang.replace('\n','')
> > >
> > > is this correct? it doesn't seem to work. :(
> > >
> > > Cheers,
> > >
> > > .ben
> > >
> > > _______________________________________________
> > > Javascript mailing list
> > > Javascript at LaTech.edu
> > > http://www.LaTech.edu/mailman/listinfo/javascript
> > >
> > _______________________________________________
> > Javascript mailing list
> > Javascript at LaTech.edu
> > http://www.LaTech.edu/mailman/listinfo/javascript
> >
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> http://www.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list