> the original regex that Gordon said "worked" was: > > : >> if ($line =~ m/.*\,.*\,.*\,.*\,.*\,.*/){ > > which would match ",,,,," quite happily. perhaps in this > application it's expected that there won't be anything > between the commas...
if ($line =~ m/(?:[^,]+\,){5}[^,]+/)) { should do the trick. Basically, it works like: [^,] - non comma characters [^,]+ - one or more non comma characters \, - comma [^,]+\, - one or more non comma characters followed by a comma (?:[^,]+\,) - as above, but in non-capturing brackets (?:[^,]+\,){5} - do this pattern 5 times Easy huh? :) Jonathan Paton __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]