in reply to regular expression help

Get rid of the space after the 3. It was added to by the CB line breaker. And by the way, the parens around \d are useless and slow down the match.
print grep /^(?:[^,]*,){4},{3}\d,0,\d/, <DATA>; __DATA__ 1,2,0,First Test,,,,0,0,7,,,,,,,,,,, 1,2,0,Starting madvise bss tests,1,buffer,G,1,1,0,Y,,,P,G,,,,,, 1,2,0,Starting madvise bss tests,2,buffer,G,1,2,0,Y,,,P,G,,,,,, 1,2,0,Starting madvise bss tests,3,buffer,G,1,3,0,Y,,,P,G,,,,,, 1,2,0,Second Test,,,,0,0,7,,,,,,,,,,, 1,2,0,Starting madvise bss tests,1,buffer,G,1,1,0,Y,,,P,G,,,,,, 1,2,0,Starting madvise bss tests,2,buffer,G,1,2,0,Y,,,P,G,,,,,, 1,2,0,Starting madvise bss tests,3,buffer,G,1,3,0,Y,,,P,G,,,,,,
1,2,0,First Test,,,,0,0,7,,,,,,,,,,, 1,2,0,Second Test,,,,0,0,7,,,,,,,,,,,

Replies are listed 'Best First'.
Re^2: regular expression help
by bobafett (Initiate) on Jul 24, 2008 at 23:34 UTC
    Hello Ikegami,

    Thanks for the solution it works.
    If the data is \t (tab) separated instead of comma separated, should I be replacing all the commas in the reg expression to \s as shown.
    print grep /^(?:^\s*\s){4}\s{3}\d\s0\s\d/, <DATA>; Thanks
    Bobafett
      print grep /^(?:[^\t]*\t){4}\t{3}\d\t0\t\d/, <DATA>;