import re with open('c:/Users/Admin/TNCSC_Odoo/addons/tncsc_deployment/views/website_pages.xml', 'r', encoding='utf-8') as f: content = f.read() pattern = r'
\s*Home\s*\|\s*About Us\s*\|\s*Membership\s*\|\s*Contact\s*
' matches = re.findall(pattern, content) print(f'Found {len(matches)} exact matches') replacement = '''
Home | About Us | Membership | Contact
''' new_content = re.sub(pattern, replacement, content) with open('c:/Users/Admin/TNCSC_Odoo/addons/tncsc_deployment/views/website_pages.xml', 'w', encoding='utf-8') as f: f.write(new_content) print("Replacement complete.")