17 lines
807 B
Python
17 lines
807 B
Python
import re
|
|
|
|
with open('home_content.html', 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
# Replace all "Schedule an initial assessment" links
|
|
pattern1 = r'(<a[^>]*href=")([^"]+)("[^>]*>\s*Schedule an initial assessment\s*</a>)'
|
|
content = re.sub(pattern1, r'\g<1>https://calendly.com/ktmckeand/coaching-assessment\g<3>', content, flags=re.IGNORECASE)
|
|
|
|
# Replace the "Book Now" link specifically for Initial Assessment
|
|
block_pattern = r'(<h3[^>]*>Initial Assessment</h3>.*?<p[^>]*>Free</p>.*?<p>30 minutes</p>.*?<div class="wp-block-buttons">.*?<a[^>]*href=")([^"]+)("[^>]*>Book Now</a>)'
|
|
|
|
content = re.sub(block_pattern, r'\g<1>https://calendly.com/ktmckeand/coaching-assessment\g<3>', content, flags=re.DOTALL)
|
|
|
|
with open('home_content_updated.html', 'w', encoding='utf-8') as f:
|
|
f.write(content)
|