Yes, that could be used, but the problem I see with substr here is that we cannot be sure whether the version number has one or two or several digits, so you need further processing for determining that. To me, a regex substitution is simpler in this context.