Change terminator checking to a regex, so we can match multiple digits