[Javascript] RegExp

Mikael Lindström mikael.lindstrom at nipsoft.se
Wed Oct 10 04:53:04 CDT 2001


I'm sorry but I forgot to say that you need to assign your replace to a
variable.

Like this

.
.
.

strString = strString.replace(/\n/,'');

.
.
.


> -----Original Message-----
> From: javascript-admin at LaTech.edu
> [mailto:javascript-admin at LaTech.edu]On
> Behalf Of .ben
> Sent: Wednesday, October 10, 2001 11:44 AM
> To: javascript at LaTech.edu
> Subject: 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