Fix Version.match? with ~> and -dev versions

Fixes #1918.