in reply to Need version regex

Maybe my brain is running slow due to turkey overload, but I don't think you're making sense. What problem are you trying to solve?

It sounds like you're trying to create a regex that matches some set of version numbers, but beyond that I'm lost. What does it mean for a regex to "1:1 carry any information in a given version number"? What does it mean for two regexes to "match each other"?

Slow down and spell it out. If you're really looking for a regex show us some samples of what it should match and what it should not match.

-sam

Replies are listed 'Best First'.
Re^2: Need version regex
by Anonymous Monk on Nov 26, 2004 at 21:12 UTC
    OK, here is what I try to accomplish. I want to create a package system (like rpm for example) which could be used for very minimal installations. That system should work down to "uninstall rm". So this system can't be dependent on large packages like perl. Of course one could use perl to create the packages. The database must store the version numbers. That means "1:1...". But I don't need to store them in a form unsuitable to matches. I want to use sed to extract information from this packageDB. sed because no other program is likely to be installed then. So I want the version numbers in a form that sed can use for comparision. That is a regex. Regexes match strings. Regexes are represented (in packageDB at least) as strings. Regexes could match a string that represents another (or the same) regex. If that match works is in version regexes a sign of order. That means "A regex matches a regex". Something I had left out: There could be a regex that matches all version regexes and is matched by them in turn so is equal to all -> a wildcard. That is another bonus for regexes, or have you ever heard of a wildcard number?

    Slow enough?

      OK, here is what I try to accomplish. I want to create a package system (like rpm for example) which could be used for very minimal installations. That system should work down to "uninstall rm". So this system can't be dependent on large packages like perl. Of course one could use perl to create the packages. The database must store the version numbers. That means "1:1...". But I don't need to store them in a form unsuitable to matches. I want to use sed to extract information from this packageDB. sed because no other program is likely to be installed then. So I want the version numbers in a form that sed can use for comparision.

      Ok, this sounds reasonable enough. I personally won't work on a system so archaic that it doesn't come with Perl installed, but I guess some people might.

      That is a regex.

      Hold up here. You just lost me. You want to store the version number as a regex? Whatever for? I can think of a number of simpler ways to accomplish your goals. How about a tiny C program that parses version numbers and does the comparison? Then you won't even need sed! Or do it using /bin/sh for that old-timey appeal.

      That is another bonus for regexes, or have you ever heard of a wildcard number?

      Well, I've heard of wildcards and I've heard of numbers... But a "wildcard number"? No, can't say that I have.

      -sam

        It's not archaic, it's minimal (think bootdisk). Of course I could write such a program, but it wouldn't be appropriate here (I would have to compile it, so no perl ;-) and more important, because sed would be likely installed, it would be extra. See minimal.