in reply to Re: Using a regex to extract a version from a Un*x path
in thread Using a regex to extract a version from a Un*x path

I hadn't thought it through trying to split on '/'. Interesting. I'll have to see where that goes. Thanks.

Such an amazing bunch of replies. Thanks so much, all answers are very much appreciated.

  • Comment on Re^2: Using a regex to extract a version from a Un*x path

Replies are listed 'Best First'.
Re^3: Using a regex to extract a version from a Un*x path
by AnomalousMonk (Archbishop) on Mar 18, 2010 at 20:32 UTC

    I, too, very much like JavaFan's approach of Re: Using a regex to extract a version from a Un*x path. However, since I've already composed this reply, you might as well see it.

    To avoid the confusion introduced by the presence of  'V2' in some paths, I depend on the presence of the magical  'V2DepCheck' sub-string. (JavaFan neatly avoids this issue by parsing right-to-left, but the regex approach I use must parse left-to-right.) Many more regexes are defined than in other approaches, but I find that it sometimes pays to be painfully explicit when the problem set is ill-defined and mutable, and maintenance may be an issue.

    Code:

    Output: