in reply to Regex to break up rpm filenames
$filename = "urpmi-parallel-ssh-4.0-20.1mdk.noarch.rpm"; print "$filename\n"; if ($filename =~ /^(.+)-([^-]+)-([^-]+)\.(\w+)\.rpm$/ ) { print "package: $1\n", "version: $2\n", "release: $3\n", "arch: $4\n"; }
•Update: made the pattern simpler and more universal
•Update: and even simpler, based on a document describing what an rpm name can look like
•Update: added explanation what the components are
|
|---|