import re
regex = re.compile(r"(\d+),\1")
test_str = ("s(469,469\"Ahn'Kahar Blood Hunter'sBattlegear(Lookalike)\",50413,49952,50071,50000},nil)\n"
"s(470,470\"Ahn'Kahar Blood Hunter's Battlegear (Lookalike)\",{51877,51911,51853,51914},nil)\n"
"s(471,471\"Ahn'Kahar Blood Hunter's Battlegear (Lookalike)\",{51002,51566,51325,50789},nil)\n\n")
subst = "\\1"
result = regex.sub(subst, test_str, count=1)
if result:
print(result)
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html