Filter out illegal characters from version number