From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.gentoo.org (smtp.gentoo.org [134.68.220.30]) by robin.gentoo.org (8.13.3/8.13.3) with ESMTP id j26N0Lr9005742 for ; Sun, 6 Mar 2005 23:00:21 GMT Received: from outbound4.mail.tds.net ([216.170.230.94]) by smtp.gentoo.org with esmtp (Exim 4.42) id 1D84jU-0000GD-SN for gentoo-dev@robin.gentoo.org; Sun, 06 Mar 2005 23:00:20 +0000 Received: from piment.flatmonk.org (h69-21-250-41.69-21.unk.tds.net [69.21.250.41]) by outbound4.mail.tds.net (8.12.10/8.12.2) with ESMTP id j26N0JNG027409 for ; Sun, 6 Mar 2005 17:00:19 -0600 (CST) Received: by piment.flatmonk.org (Postfix, from userid 10208) id E9E45113EAE; Sun, 6 Mar 2005 18:00:18 -0500 (EST) Date: Sun, 6 Mar 2005 17:49:19 -0500 X-OfflineIMAP-x1920292674-70696d656e7473656e64-494e424f582e4f7574626f78: 1110149462-0361765367723-v4.0.8 From: Aron Griffis To: gentoo-dev@robin.gentoo.org Subject: Re: [gentoo-dev] Parsing emerge Message-ID: <20050306224919.GB13606@mustard.flatmonk.org> References: <1109924970.11103.19.camel@secures> <1109999484.11103.54.camel@secures> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Reply-To: gentoo-dev@gentoo.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="QTprm0S8XgL7H0Dt" Content-Disposition: inline In-Reply-To: <1109999484.11103.54.camel@secures> User-Agent: Mutt/1.5.6i X-Archives-Salt: 68bbd9fe-f949-4a6e-9ee6-cdcc289e4aed X-Archives-Hash: 13b456f6e19626be1cc6e8f68a182435 --QTprm0S8XgL7H0Dt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Chris White wrote: [Sat Mar 05 2005, 12:11:24AM EST] > sub package_nvsplit { > $i=0; > while($_[$i] !~ /^\d/) { > $i++; > } > $package_end=$i-1; > $pn=join("-",@_[0..$package_end]); > $pv=@_[$i..$#package_array]; > return $pn, $pv; > } my ($cat, $name, $ver) = m{(.*)/(.*?)-(\d.*)}; There are much better regexes that will actually validate, but the above regex does everything you described. If you're interested in completed Perl code to correctly sort ebuilds according to portage rules, see http://dev.gentoo.org/~agriffis/darcs/skel/bashrc.funcs and search for sortvers. Regards, Aron -- Aron Griffis Gentoo Linux Developer --QTprm0S8XgL7H0Dt Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCK4jvJrHF4yAQTrARAtDcAKDOQQovMryrSwvAlRuFnwN1tRPDawCgjhOZ Wt8yFSm//D4H1dlkT8oSGXQ= =gF9J -----END PGP SIGNATURE----- --QTprm0S8XgL7H0Dt-- -- gentoo-dev@gentoo.org mailing list