Thread WordWrapper Regex: Für Perfektionisten
(6 answers)
Opened by Thorium at 2003-08-19 16:56
$width=80;
$_ = join "", <STDIN>; while(length > $width || /\n/){ (s%^(.{1,$width})\n%%) or # wrap at newline s%^(.{1,$width}) +%% or # wrap at space (which will be removed) s%^(.{1,$width}[,\?\!\./])%% or # wrap at one of,?!./ s%^(.{$width})%%; # wrap exactly at the edge of the screen push @lines, $1; } print "$_\n" for @lines; Lieblingsmodule:
![]() ![]() |