Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jun 2002 00:16:02 -0400
From:      parv <parv@pair.com>
To:        Christopher Hall <hsw@acm.org>
Cc:        f-ports <freebsd-ports@FreeBSD.ORG>
Subject:   Re: regex to parse port version/name
Message-ID:  <20020621041602.GA75915@moo.holy.cow>
In-Reply-To: <200206210123.g5L1NmaR076373@x4.tucheng.generalresources.com>
References:  <20020621004849.GB67220@moo.holy.cow> <200206210123.g5L1NmaR076373@x4.tucheng.generalresources.com>

next in thread | previous in thread | raw e-mail | index | archive | help
in message <200206210123.g5L1NmaR076373@x4.tucheng.generalresources.com>,
wrote Christopher Hall thusly...
>
> In message <20020621004849.GB67220@moo.holy.cow>,
>   parv writes:
...
> > here is my (perl) version based on the ports i have installed...
> >
> > m#^(/var/db/pkg/)(.+?)(-(?:no.+?)?(?:\d+[-_.,\w]*|pl.+))$#
> >
> > $1 contains '/var/db/pkg/'
> > $2          port name (w/o version)
> > $3          port version (w/o name)
...
> > http://www103.pair.com/parv/comp/unix/bin/listpkg
>
> won't something simpler like this work?
>     /^(.*)-([^-]*)$/
>     $1 = port name
>     $2 = port version

thanks.  i didn't think of that that generally: "[^-]+".  i couldn't
find any installed port which would have a hyphen in its version
ignoring "-without-blah" or "-noblah".  so that will work until a port
version string starts to contain hyphen(s).

i have also updated the perl substitution regex; now is divided
into two parts to care of 'without-blah' like strings.  and the
shell script starts to look like more & more perl.


  - parv

--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020621041602.GA75915>