Replaced poor substring method with preg_match based method

New version works with version numbers that aren't exactly three (a la
2.4.1.0 and 2.1).