in reply to RE: Re: searching backwards in a string
in thread searching backwards in a string
Has a slight problem of not grabbing the last line, but it's 99% of the way there, and besides, that's why you should use a module in the first place:)use strict; my $text = "This is a long line that I am typing to demonstrate". " the way that my regular expression works and it's a". " run-on sentence too but I don't really care."; print $1, "\n" while($text =~ /(.{0,20})\s+/g);
|
|---|