import re path = r'd:\Users\chenjun\kyj-yanglao-web-new\src\views\elderly\apply\check-in\ContractForm.vue' with open(path, 'r', encoding='utf-8') as f: content = f.read() # 修复有 class="fill" 的双重嵌套: # # -> # pattern_nested = r'' matches = re.findall(pattern_nested, content) print(f"Found nested fill patterns: {len(matches)}") def repl_nested(m): inner_expr = m.group(1) # {{ contractForm.field || '___' }} field = m.group(2) # field return f'' content_new = re.sub(pattern_nested, repl_nested, content) # 检查是否还有残余的双重嵌套问题 remaining = re.findall(r'