$tempVale =~ s/\r?\n/<br>/g;

 --- "vega, james" <[EMAIL PROTECTED]> wrote: 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] 
> > [mailto:[EMAIL PROTECTED] On 
> > Behalf Of Glenn Linderman
> > Sent: Friday, November 05, 2004 1:48 PM
> > To: Martin Leese
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: How remove newlines?
> > 
> > 
> > On approximately 11/5/2004 10:38 AM, came the following 
> > characters from 
> > the keyboard of Martin Leese:
> > > Hi,
> > > 
> > > A nice easy one for a Friday afternoon.
> > > 
> > > I have a variable containing text in which I wish to
> > > convert embedded newlines to spaces.  And, I wish to
> > > do this in a way which is portable.
> > > 
> > > I have come up with:
> > > 
> > >     $tempValue =~ s/\r\n/ /g;
> > >     $tempValue =~ s/\n/ /g;
> > > 
> > > I believe this pair of statements will work on both
> > > Windows and UNIX, and with text originating on both
> > > Windows and UNIX.  I welcome improvements.
> > > 
> > > Also, how do I accommodate Macs?
> > 
> > If a sequence of newlines can be converted to a single space, then
> > 
> > $tempValue =~ s/[\r\n]*/ /g;
> 
> That should be:
> 
> $tempValue =~ s/[\r\n]+/ /g;
> 
> Otherwise you'll end up putting spaces in more places than you like.
> 
> > will do it.  Otherwise, add
> > 
> > $tempVale =~ s/\r/ /g;
> > 
> > to your existing commands. (AFAIK -- I've never owned a Mac)
> > 
> > -- 
> > Glenn -- http://nevcal.com/
> > ===========================
> > Having identified a vast realm of ignorance, Wolfram is 
> > saying that much of this realm lies forever outside the light 
> > cone of human knowledge.
> >                            -- Michael Swaine, Dr Dobbs 
> > Journal, Sept 2002 _______________________________________________
> > Perl-Win32-Users mailing list 
> > [EMAIL PROTECTED]
> > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> > 
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>  

______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to