help with regex
| From: | C.F. Scheidecker Antunes | Date: | Fri, 30 Jul 2004 20:51:08 +0000 |
| Subject: | help with regex | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-192353@lists.php.net to get a copy of this message | ||
Hello,
I has as the output of a unzip command called from a PHP script the following:
unzip test.zip
Archive: test.zip
inflating: arch1.txt
inflating: arch2.txt
inflating: arch3.txt
inflating: arch4.txt
inflating: arch5.txt
inflating: arch6.txt
The same I have from a pkware execution :
pkunzip teste.zip
PKZIP(R) Version 6.0 FAST! Compression Utility for Linux X86
Copyright 1989-2002 PKWARE Inc. All Rights Reserved. Evaluation Version
PKZIP Reg. U.S. Pat. and Tm. Off. Patent No. 5,051,745
Extracting files from .ZIP: teste.zip
Inflating: arch1.txt
Inflating: arch2.txt
Inflating: arch3.txt
Inflating: arch4.txt
Inflating: arch5.txt
So, I need some help on how to write a regexp to get the values after inflating, that is the filenames, and put them in an array. Both outputs above are stored on a $stdout php variable.
Also, I need to be able to indentify errors with the unzip utility that does not support some types of zip file, the output is like this:
unzip test1.zip
Archive: test1.zip
skipping: test1.txt `shrink' method not supportedThere's a skipping instead of a inflating or Inflating in pkware. The third situation is an error on the zip file itself : unzip test2.zip Archive: test2.zip End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive. unzip: cannot find zipfile directory in one of test2.zip or
test2.zip.zip, and cannot find test2.zip.ZIP, period.or pkunzip test2.zip PKZIP(R) Version 6.0 FAST! Compression Utility for Linux X86 Copyright 1989-2002 PKWARE Inc. All Rights Reserved. Evaluation Version PKZIP Reg. U.S. Pat. and Tm. Off. Patent No. 5,051,745 Extracting files from .ZIP: test2.zip Errors were found in .ZIP file, attempt to fix (<Y>es/<N>o)? N PKZIP: (Z152) No CE signature found Help is much appreacited. Thanks in advance.