Fix regex in extract

This commit is contained in:
DazedAnon 2024-10-15 12:13:10 -05:00
parent 6f38cad661
commit 5c6aac9ed9

View file

@ -2673,7 +2673,7 @@ def elongateCharacters(text):
def extractTranslation(translatedTextList, is_list):
try:
translatedTextList = re.sub(r'\\"+\"([^,\n}])', r'\\"\1', translatedTextList)
translatedTextList = re.sub(r'(?<![\\])"+', r'"', translatedTextList)
translatedTextList = re.sub(r'(?<![\\])\"+(?!\n)', r'"', translatedTextList)
line_dict = json.loads(translatedTextList)
# If it's a batch (i.e., list), extract with tags; otherwise, return the single item.
string_list = list(line_dict.values())