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 [,;.]. in this context the ?: is for grouping purposes such that (?:a|b|c) is the (a\b\c) but $1 doesn't get assigned anything because the ?: tells it to not backreference this match group; however, you have it nested in another grouping that is apparently capturing the backreference otherwise $1 would not be set. Here is a snippet from O'Reilly under regular expression extensions: (?:...) This groups things like "(...)" but doesn't make backreferences like "(...)" does. So: split(/\b(?:a|b|c)\b/) is like: split(/\b(a|b|c)\b/) but doesn't actually save anything in $1, which means that the first split doesn't spit out extra delimiter fields as the second one does. I did get the expected result for the first expression when I moved the second ? inside the nested () of this expression. Hmm - yes, that was the reason we tried using (?:...) grouping, so the ? would be applied to the \S{80,}. So I saw a space added after every .,; - that was more a test of what I thought the original RE was trying to do. I missed the 'non-greedy' facet, that's exactly the answer I was looking for. Thanks! ------------------- 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