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 as:
$text =~ s/(\S{80,}[,;.])(\S)/$1 $2/g;

that is, w/o the '?' after the char spec but different than:
$text =~ s/((?:\S{80,})?[,;.])(\S)/$1 $2/g;

where here the '?' seems active and every ,.; has a space after it.
Thinking about the first one, this is how that one *should* behave (I
think) but apparently the '?' isn't really allowing zero of those. Trying:
$text =~ s/(\S{80,}*[,;.])(\S)/$1 $2/g;

gets a nested qualifier RE error.  Just curious if there's an explanation
for this.

Thanks.

a
-------------------
Andy Bach
Systems Mangler
Internet: [EMAIL PROTECTED]
Voice: (608) 261-5738 Fax: 264-5932

It's is not its, it isn't ain't, and it's it's, not its, if you mean it
is.  If you don't, it's its.  Then too, it's hers.  It isn't her's.
It isn't our's either.  It's ours, and likewise yours and theirs.
         -- Oxford University Press, Edpress News

_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to