import re
with open('_get_instance_details.php', 'r') as f:
content = f.read()
pattern = re.compile(r"<\?php foreach \(\$currentNode\['ui_hints'\]\['form_schema'\] as \$field\): \?>(.*?)<\?php endforeach; \?>", re.DOTALL)
replacement = r"""
>
"""
if pattern.search(content):
content = pattern.sub(replacement, content, count=1)
with open('_get_instance_details.php', 'w') as f:
f.write(content)
print("Patched successfully!")
else:
print("Pattern not found!")