Commit 86600d6c by sikang

bug fix

parent 607c07f4
...@@ -28,14 +28,14 @@ class ActivityGarble: ...@@ -28,14 +28,14 @@ class ActivityGarble:
for (src, dst) in self.activity_mapping.items(): for (src, dst) in self.activity_mapping.items():
#避免命名重复,确保要替换的部分前后没有合法的命名字符,如果有则还原 #避免命名重复,确保要替换的部分前后没有合法的命名字符,如果有则还原
file_content = file_content.replace(src, dst) file_content = file_content.replace(src, dst)
before = re.findall(r'[0-9a-zA-Z_]'+dst,file_content) before = re.findall(r'[0-9a-zA-Z]'+dst,file_content)
if before != None: if before is not None:
for name in before: for name in before:
char = name.split(dst)[0] char = name.split(dst)[0]
file_content = file_content.replace(name, char + src) file_content = file_content.replace(name, char + src)
after = re.findall(r''+ "%s[0-9a-zA-Z_]"% dst,file_content) after = re.findall(r''+ "%s[0-9a-zA-Z]"% dst,file_content)
if after != None: if after is not None:
for name in after: for name in after:
char = name.split(dst)[1] char = name.split(dst)[1]
file_content = file_content.replace(name, src + char) file_content = file_content.replace(name, src + char)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment