On Sun, 16 Mar 2003, Andrew Savige wrote: > En op 16 maart 2002 sprak Rick Klement: > > And one without that ugly \S : > > > > s/^((.+ ).+)\n\2/$1 /m&&redo > > That looks fine to me. I noticed Bass sprak on 13 maart: > > > #!perl -p0 > > s#^(\S* )(.*)\n\1#$1$2 #m&&redo > > > > If the input contains no duplicate lines, the "\S*" can be replaced > > > with ".*". > > Yet ".*" seems to work fine with duplicate lines. I can't find any > test data where "\S*" behaves differently to ".*".
Yes, my bad, of course. I was thinking about this: a b a c a b but the regex-engine in my head didn't realize there will _not_ be a space after the third line for the \1 to match. Should have just tried that .* even once before opening my mouth ;-) Maybe mrmagoo.pl could also try replacing any "\S", "\d", etc with a "." :-) -bass