On Tue, Jan 08, 2002 at 01:30:12PM -0800, Yitzchak Scott-Thoennes wrote: > >On Tue, Jan 08, 2002 at 11:50:44AM -0800, Yitzchak Scott-Thoennes wrote: > > -n $,=':';$\=$/;print grep$_,/\G\s*(?:"([^"]*)"(?:\s|$)|([^\s#]+))/g; > > (but what a poor score it gives... :/ ) > > It gets worse: > While whitespace separates fields, the last field could have a comment next.
Ugh, missed that one too. :) > And "" is an empty field. But I think the \G is unnecessary. I think the \G is necessary because the regex doesn't explicitly match the comment. The \G forces it to stop when it gets to the comment, rather than skipping over the # and matching more fields. Ronald
