import re
teststring = "Lorem 'hello_kitty.cmd?command91' ipsum hello_kitty.cmd?command92"
print(re.sub(r"'\w+\.\w{3}[^']*'", "'x'", teststring))
aW1wb3J0IHJlCnRlc3RzdHJpbmcgPSAiTG9yZW0gJ2hlbGxvX2tpdHR5LmNtZD9jb21tYW5kOTEnIGlwc3VtIGhlbGxvX2tpdHR5LmNtZD9jb21tYW5kOTIiCnByaW50KHJlLnN1YihyIidcdytcLlx3ezN9W14nXSonIiwgIid4JyIsIHRlc3RzdHJpbmcpKQ==