I should add that it works for this reason:
.+ :.+ matches (one or more characters) as much as it can before moving on. Also known as the “maximum munch”. So given the pattern .+\d and the string-to-test as abc123def345 the .+ part would match abc123def34 because the ending 5 would satisfy the \d in the pattern.
.+? :.+? matches (one or more characters) as little as possible before moving on. Also known as the “minimum munch”. With the pattern .+?\d and the same string-to-test, the .+? part would match abc because the following 1 would match the \d.