Which part of "complicated logic", do you not understand? :)
Every time a new version types is added, or there is a new change in the configuration management system, you add a function tailored specifically to that type of path.
A single regular expression is the wrong way to deal with this, you need a factory pattern.