Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Converting carriage returns to HTML breaks

by Anonymous Monk
on Apr 16, 2012 at 03:23 UTC ( #965231=note: print w/replies, xml ) Need Help??


in reply to Converting carriage returns to HTML breaks

split() the string using a regex that looks for [\n\r]{1,2} then join() the string using <br/> as the separator.
  • Comment on Re: Converting carriage returns to HTML breaks

Replies are listed 'Best First'.
Re^2: Converting carriage returns to HTML breaks
by AnomalousMonk (Bishop) on Apr 16, 2012 at 15:27 UTC

    I think that should be  [\n\r]{1,2} and  '<br/>' and whether it will actually work is another question.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2021-01-19 18:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?