Skip to content

Commit

Permalink
1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
3093FengMing committed Mar 6, 2024
1 parent a23076b commit a805f3f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions WorldTranslationExtractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ def sub_replace(pattern: re.Pattern, string: str, repl, dupe=False, search_all=T
if search_all:
loop_count = 0
last_match = None
last_pos = 0
match = pattern.search(string, last_pos)
match = pattern.search(string)
# can delete the 2 lines below
if match is None:
return string
Expand All @@ -70,8 +69,7 @@ def sub_replace(pattern: re.Pattern, string: str, repl, dupe=False, search_all=T
raise Exception(f"TOO MANY COMPONENTS HERE: {string}")
span = match.span()
ls[span[0]:span[1]] = repl(match, dupe=dupe)
last_pos = span[1]
match = pattern.search(''.join(ls), last_pos)
match = pattern.search(''.join(ls))
last_match = match
return ''.join(ls)
else:
Expand Down

0 comments on commit a805f3f

Please sign in to comment.