On Fri, Aug 03, 2007 at 04:48:41PM +0200, Bluefuture wrote: > > > > Still, a part of the bug here could still be addressed. What is needed is > > to > > scan for a dash from the end of the version string, and separate it there > > into 'debian revision' and 'upstream'. > > > > E.g. this version number: > > 1.4.6-20060409-1 > > should be split in upstream '1.4.6-20060409' and debian '1'. > > > > > > Thijs > > This is actually the convertion function with regular expression: > > function vers_conv($debvers) { > preg_match("/(.+:)?([^-]+)(ds|dsfg|debian)/",$debvers,$matches); > if (!$matches[3]) { > unset($matches); > preg_match("/(.+:)?([^-]+)/",$debvers,$matches); > } > if (substr($matches[2],-1)=='.') $matches[2]=substr($matches[2],0,-1); > return $matches[2]; > } > > How do u suggest to modify regular expression? Well, the revision should be an integer. But (I think) it's best to not try to match it at all; is it needed for something?
Untested: LC_ALL=C /^(([0-9]+):)?([a-zA-Z0-9.+:-]+)(-([a-zA-Z0-9.+]+))?$/ || die debianrevision=$2 # or unset upstreamver=$3 debianrev=$5 # or unset This is simpler without splitting out the revision. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]