D
donebrowsers
I have the following dataset:
zoo-2.10.1p1
mutt-1.4.2.3-compressed
lha-1.14i.ac20050924.1
mysql-server-5.0.45
p5-Archive-Tar-1.30
php5-gd-5.2.3-no_x11
There are package listings on an OpenBSD machine. I want to parse the
package name, the version, and if there is a flavor, that too. I want
the following:
[zoo] [2.10.1p1]
[mutt] [1.4.2.3] [compressed]
[lha] [1.14i.ac20050924.1]
[mysql-server] [5.0.45]
[p5-Archive-Tar] [1.30]
[php5-gd] [5.2.3] [no_x11]
I currently have this regex (which is close but doesn't quite work):
/(^.*)-(.*)($-\w)?/
It currently gives me:
[zoo] [2.10.1p1]
[mutt-1.4.2.3] [compressed]
[lha] [1.14i.ac20050924.1]
[mysql-server] [5.0.45]
[p5-Archive-Tar] [1.30]
[php5-gd-5.2.3] [no_x11]
As you can see I'm having issues with the flavor (the last part of the
package name which not every package has) part. Any help?
zoo-2.10.1p1
mutt-1.4.2.3-compressed
lha-1.14i.ac20050924.1
mysql-server-5.0.45
p5-Archive-Tar-1.30
php5-gd-5.2.3-no_x11
There are package listings on an OpenBSD machine. I want to parse the
package name, the version, and if there is a flavor, that too. I want
the following:
[zoo] [2.10.1p1]
[mutt] [1.4.2.3] [compressed]
[lha] [1.14i.ac20050924.1]
[mysql-server] [5.0.45]
[p5-Archive-Tar] [1.30]
[php5-gd] [5.2.3] [no_x11]
I currently have this regex (which is close but doesn't quite work):
/(^.*)-(.*)($-\w)?/
It currently gives me:
[zoo] [2.10.1p1]
[mutt-1.4.2.3] [compressed]
[lha] [1.14i.ac20050924.1]
[mysql-server] [5.0.45]
[p5-Archive-Tar] [1.30]
[php5-gd-5.2.3] [no_x11]
As you can see I'm having issues with the flavor (the last part of the
package name which not every package has) part. Any help?