The code at that Re^5: regex at word boundary fails on overlapping palindromes, not that I'm aware of any that exist in the wild. Such that adding

nested testest detsen nested
i prefer pi ip referp
yeilds:

line 7:
(0) "nested testest detsen nested"
(7) "testest detsen nested"
(15) "detsen nested"
(22) "nested"

line 8:
(0) "i prefer pi ip referp"
(2) "prefer pi ip referp"
(9) "pi ip referp"
(12) "ip referp"
(15) "referp"
I also tested it on a handy text file of 79,569 lines and it ran much slower than the code I listed above, modified to just test on each line, not each paragraph.
sunorccws04 ~$ time ./mr_pal.pl trf > mr.out

real    1m2.161s
user    1m1.210s
sys     0m0.280s

sunorccws04 ~$ time ./qm_pal.pl trf > qm.out

real    2m53.492s
user    2m49.070s
sys     0m1.690s
trf is the output of a tcpdump session. Other data sets are sure to produce differing comparative speeds.

Be Appropriate && Follow Your Curiosity

In reply to Re^2: regex at word boundary by mikeraz
in thread regex at word boundary by mikeraz

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.