<|file_name|>String Incrementer.py<|end_file_name|><｜fim▁begin｜>"""
Your job is to write a function which increments a string, to create a new string. If the string already ends with a number, the number should be incremented by 1. If the string does not end with a number the number 1 should be appended to the new string.

Examples:

foo -> foo1

foobar23 -> foobar24

foo0042 -> foo0043

foo9 -> foo10

foo099 -> foo100

Attention: If the number has leading zeros the amount of digits should be considered.

"""
import re
def <|fim_middle|>(strng):
        match = re.match(r"(.*?)(\d*)$",strng)
        string = match.group(1)
        number = match.group(2)
        if not number:
                return string + '1'
        else:
                return string + str(int(number)+1).zfill(len(number))
<｜fim▁end｜>
increment_string