I noticed the end '-' thing too. I did add a section to ccn's code that handles that. Its tagged w/ the "# ADDED" comment.
++ btw ccn, took me awhile to wrap my head around this one.
my $brackets = qr(\[[^\]]*\]); # text enclosed in brackets my $char = qr([^\[\]\s]); # not spaces or brackets s{ ( # group to $1 (?: $char # a char (?:$brackets*) # followed by any number of brackets ) {3} # 3 times ) (?!(?:$brackets*)(?:\s|\Z)) # ADDED: eliminates '-' on the end of wo +rds w/ a multiple of 3 chars (?= # looking forward to ensure that [^\[\]]* # we are not inside of a brackets (?: \[ | \z ) ) } {$1-}gx; print;
In reply to Re^3: Problem: how to split long words
by jbware
in thread Problem: how to split long words
by nikos
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |