use strict; use warnings; sub ubb_txt { my $txt = shift; return "" unless ( defined $txt); my ($nl) = $txt =~ m{(\cM?\cJ)}; $txt =~ s{$nl$nl}{</p><p>}gs if (defined $nl); $txt =~ s{$nl}{<br>}gs if (defined $nl); $txt; } my $test = <<'--'; One fish Two fish Red fish Blue fish -- print ubb_txt ($test), "\n"; __END__ One fish<br>Two fish</p><p>Red fish<br>Blue fish<br>
Seems like the first regexp isn't eating all the newlines.
Abigail
In reply to Re: catching newlines from textarea input
by Abigail-II
in thread catching newlines from textarea input
by maksl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |