This won't work, as [] matches only one character from the list inside:
$regexp = '(.+)-(.+)\.[tar.gz|zip]
Intention for this was one was to get file name and version:
preg_match('/^(.+?)-([0-9.]+(?:-.*)|[^-]+)\.(tar.gz$|zip$)/', $file, $matches);
[0-9.] is the same as .. Maybe the dot should be after the "+"?. I don't know what author wanted to express. This whole expression looks a bit broken for me...
| Comment | File | Size | Author |
|---|---|---|---|
| regexp-20050508.diff | 1.19 KB | Cvbge |
Comments
Comment #1
killes@www.drop.org commentedWhat are you traing to fix?
Comment #2
killes@www.drop.org commentedCommitted first two chunks.
Comment #3
Steven commentedI don't think so... a dot inside [] means the literal dot character, not just any character like outside the square brackets. Try this:
Comment #4
(not verified) commented