generalize version parsing; reuse regex