Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-04-23 12:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found