in reply to Re: Re: highlight and line breaks
in thread highlight and line breaks
the tags have to be zero characters long for the wrapping purposes.
That's more difficult. I would probably do it like this:
$_ = "foo<span>bar</span>bazqux<span>quux</span>"; my $c=0; s( (<span>|</span>|.) ) { my $s = $1; $s =~ m!</?span>! ? $s : $s . (++$c % 4 ? '' : "\n"); }sxge; print; print "\n";
That will show you how it works but in your case you'll need to change that '4' to '80' in the ++$c % 4 part.
Update: added /s to regex so . would match "\n" as well.
-sauoq "My two cents aren't worth a dime.";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: highlight and line breaks
by Aristotle (Chancellor) on Jan 16, 2003 at 09:12 UTC | |
|
(counting chars but ignoring SPANs) Re4: highlight and line breaks
by bbfu (Curate) on Jan 16, 2003 at 07:30 UTC | |
by sauoq (Abbot) on Jan 16, 2003 at 08:42 UTC | |
by bbfu (Curate) on Jan 16, 2003 at 18:07 UTC |