in reply to Re: regex at word boundary
in thread regex at word boundary
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 referpyeilds:
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.690strf is the output of a tcpdump session. Other data sets are sure to produce differing comparative speeds.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: regex at word boundary
by QM (Parson) on Dec 12, 2005 at 18:16 UTC | |
by mikeraz (Friar) on Dec 12, 2005 at 18:22 UTC |