Removing Carriage Returns??? 
Author Message
 Removing Carriage Returns???

I have a script that's reading the input from an HTML form and I can't seem
to remove ALL of the carriage returns. It may not be just the very last
character, there could be some anywhere.  Since I'm writing this to a single
line text file I need to strip them all away.

print "<TR><TD><textarea Rows=8 Cols=65 name=\"body\"
wrap=phsical></textarea></TD></TR>\n";

Appreciate any help on this.

Burt Lewis



Wed, 12 Jan 2000 03:00:00 GMT  
 Removing Carriage Returns???


Quote:
> I have a script that's reading the input from an HTML form and I can't
> seem to remove ALL of the carriage returns.
> print "<TR><TD><textarea Rows=8 Cols=65 name=\"body\"
> wrap=phsical></textarea></TD></TR>\n";

It would be helpful if we could see the code you're using which attempts
to remove carriage returns. (But it would help not to see any other code.)
The code which you posted doesn't seem to be relevant, unless you're
saying that that line of test has an extra carriage return which you want
removed. In which case...

    print qq{<TR><TD><textarea Rows=8 Cols=65 name="body" },
          qq{wrap=phsical></textarea></TD></TR>\n};

(Is that word supposed to be spelled 'phsical'?) Hope this helps!

--
Tom Phoenix           http://www.teleport.com/~rootbeer/

Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



Wed, 12 Jan 2000 03:00:00 GMT  
 Removing Carriage Returns???

|> I have a script that's reading the input from an HTML form and I can't seem
|> to remove ALL of the carriage returns. It may not be just the very last
|> character, there could be some anywhere.  Since I'm writing this to a single
|> line text file I need to strip them all away.

A global search & replace on \n is all you need:

$line_of_text =~ s/\n//g;

Hope that helps.

Steve.



Sat, 15 Jan 2000 03:00:00 GMT  
 Removing Carriage Returns???


Quote:


>|> I have a script that's reading the input from an HTML form and I can't seem
>|> to remove ALL of the carriage returns. It may not be just the very last
>|> character, there could be some anywhere.  Since I'm writing this to a single
>|> line text file I need to strip them all away.

>A global search & replace on \n is all you need:

>$line_of_text =~ s/\n//g;

I'm no expert so don't take my word as law but you may also want to remove
the \r character.  When I was doing something like this I found that a
Windows browser tended to send both characters which caused unpredictable
results.

--Steve
"Oh, please.  How {*filter*}ing immature can you boys be?
Our army could kick your army's ass."



Mon, 17 Jan 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Help remove carriage return after from a character string

2. Removing carriage returns from a string under certain conditions

3. Removing carriage returns from HTML form inputs

4. removing carriage return from a string

5. Removing carriage returns from cgi

6. Remove carriage returns from input

7. how to remove carriage returns in form

8. removing carriage returns from a form entry

9. Removing Carriage returns from a multi-line string

10. HELP - Removing Carriage Returns

11. Removing Carriage Returns in Form inputs

12. How do i remove Carriage Returns og Newlines from a string via regexp's ?

 

 
Powered by phpBB® Forum Software