perl -wle '$_="|<br />|"; s{<br />}{\par}ig; print' Unrecognized escape \p passed through at -e line 1. |par|

So the first solution certainly is wrong.

And I don't see how the search-and-replace could insert some weird characters - are you sure they aren't in the string before? Use hexdump or Data::Dumper to find out:

perl5.10.0 -wle '$_="!<br />!"; s{<br />}{\\par}ig; print'|hexdump -C 00000000 21 5c 70 61 72 21 0a |!\par!.| 00000007

If you are sure that the regex is misbehaving, please give us a short, executable and self-contained piece of code that demonstrates that behaviour.


In reply to Re: Formatting rtf - problems by moritz
in thread Formatting rtf - problems by s_m_b

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.