|laziness, impatience, and hubris|
regexp word break helpby nop (Hermit)
|on Apr 30, 2002 at 20:52 UTC||Need Help??|
nop has asked for the
wisdom of the Perl Monks concerning the following question:
What's the best regexp way to say:
Make sure this string is 45 chars or less, and if you have to truncate it to make it shorter, only break it between a word (\s)?
I am using split to get words, popping words until I am below 45 chars, then joining it back together -- this seems very UnPerlish.