Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: fixing what textareas do to input

by Zoogie (Curate)
on Jun 05, 2000 at 08:42 UTC ( #16360=note: print w/ replies, xml ) Need Help??


in reply to fixing what textareas do to input

Perhaps: $data =~ s/(\r\n|\n\r|\r)/\n/g This converts CR's, LF's, and any combination of the two into a single newline (I hope... haven't tested it).


Comment on Re: fixing what textareas do to input
Download Code
Replies are listed 'Best First'.
RE: Re: fixing what textareas do to input
by antihec (Sexton) on Jun 05, 2000 at 14:27 UTC
    If you output the textarea input in HTML you might consider changing the right hand side of Zoogies regexp to /<br>\n/g
    -- bash$ :(){ :|:&};:
RE: Re: fixing what textareas do to input
by mcwee (Pilgrim) on Jun 06, 2000 at 00:40 UTC
    Would $data =~ s/(\r|\n){1,2})/\n/g work as well? (Unfortunately, I don't have time to test it out-- and I'm notorious for FUing my regexes the first time out.)

    The Autonomic Pilot

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://16360]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (15)
As of 2015-07-07 19:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls