toadi has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
got in my database tekst stored with newlines. When I display them in my html there is a newline. But is it possible to replace this regex with a
in a regex ???

--
My opinions may have changed,
but not the fact that I am right

Replies are listed 'Best First'.
Re: ASCII in regex
by davorg (Chancellor) on Aug 22, 2000 at 13:26 UTC

    You need to escape the <BR> tags in your post, otherwise they don't get displayed. Replace the opening < with &lt;.

    As for your question, you should be able to do something like:

    $text =~ s/\n/<BR>/g;
    --
    <http://www.dave.org.uk>

    European Perl Conference - Sept 22/24 2000, ICA, London
    <http://www.yapc.org/Europe/>
Re: ASCII in regex
by le (Friar) on Aug 22, 2000 at 13:23 UTC
    Your question is not quite clear to me, but it could be done via:
    s/\n/<br>/g;
Re: ASCII in regex
by toadi (Chaplain) on Aug 22, 2000 at 13:30 UTC
    I was to fast to press submit. I actually found it myself.
    --
    My opinions may have changed,
    but not the fact that I am right