in reply to Re: Regular Expressions Matching with Perl
in thread Regular Expressions Matching with Perl

Too short. That fails if the file size is 10,000,000 bytes or more.
my ($file) = $line =~ /:.{15}(.*)/;
would be minimal.

Replies are listed 'Best First'.
Re^3: Regular Expressions Matching with Perl
by Fletch (Bishop) on Apr 20, 2005 at 18:21 UTC

    Erm, it's matching against the 8 hex digits of the CRC-32. How is that affected by the file size? Granted on further examination of unzip -v output it should be anchored off the date as well.

    /:\d\d\s\s[[:hexdigit:]]{8}\s\s(.*)$/
      Erm, it's matching against the 8 hex digits of the CRC-32. How is that affected by the file size?

      If the file size is 10000000 bytes or higher, your original regexp will not match against the 8 digits of the CRC-32 as you say. Instead, it will match against the 8 digits of the file size, because they come earlier. That's why I used the date as the anchor.