good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: How do I truncate a string while preserving words?by Tomte (Priest) |
on May 11, 2007 at 08:03 UTC ( [id://614841]=note: print w/replies, xml ) | Need Help?? |
Try that should work as expected (at least as far as the presented code goes...). Edit: explanation: you can ommit the upper bound, but not the lower bound, as you did. From perlre: and you have to match the rest of the input (.*$) for it to be replaced too - otherwise you would simply insert the ellipsis (...) without truncating the input.
regards,
An intellectual is someone whose mind watches itself.
In Section
Seekers of Perl Wisdom
|
|