in reply to Re^2: Truncating after the last period
in thread Truncating after the last period
And it won't truncate a string that doesn't have a FULL STOP (U+002E) in it.
I do not see anything conditional about the OPs spec: "remove all characters after the last period.". Do you?
So,
die 'Bad data' unless $s =~ s[^.{1,400}\.\K.*$][];
It will also truncate a string in the middle of a character.
Is that really a possibility?
Cos if it is, it means perl's unicode handling must be even more broken than I thought.
I've just had a go at making it happen and failed, but maybe I'm just not clever enough.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Truncating after the last period
by Jim (Curate) on Aug 22, 2011 at 20:05 UTC | |
by BrowserUk (Patriarch) on Aug 22, 2011 at 20:11 UTC | |
by Jim (Curate) on Aug 22, 2011 at 20:24 UTC | |
by BrowserUk (Patriarch) on Aug 22, 2011 at 20:54 UTC | |
by Jim (Curate) on Aug 22, 2011 at 21:13 UTC | |
|