that is, w/o the '?' after the char spec but different than:
$text =~ s/((?:\S{80,})?[,;.])(\S)/$1 $2/g;
[MAS] I'm not sure why this works for you. It didn't for me when I created
some test data and tried it. Mine worked the same as the greedy match and
only inserted one space at the last [,;.].
See my comments bellow. I'm not sure it I helped or not but hopefully I
at least clarified ?.
Matt
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Wednesday, December 10, 2008 13:39
Cc: Perl-Unix-Users@listserv.act
Hi
We received some code to split up long non-white space strings - it has:
$text =~ s/(\S{80,}?[,;.])(\S)/$1 $2/g;
That is, if you've got 80+ non-whitespaces in a row (supposedly 'zero or
one'), followed by any(,.;)and then another non-whitespace, insert a blank.
This works but behaves the same