in reply to Re: Replacing new lines in multi line text box form fields with <br>.
in thread Replacing new lines in multi line text box form fields with <br>.

$INPUT{'comments'} =~ s/[\r\n]+/<br>\n/g;

That isn't a good pattern to use, because it means that two line-breaks in the input, such as used to indicate a paragraph break, become only one in the output.

Smylers
  • Comment on Re^2: Replacing new lines in multi line text box form fields with <br>.
  • Download Code

Replies are listed 'Best First'.
Re^3: Replacing new lines in multi line text box form fields with <br>.
by tachyon (Chancellor) on Nov 27, 2004 at 06:06 UTC

    You're right. s/\r\n|\r|\n/<br>\n/g is better.

    cheers

    tachyon