# Pattern for the specific phrase pattern = r'download\s+hp\s+easy\s+firmware\s+upgrade\s+utility' match = re.search(pattern, text, re.IGNORECASE)
if not match: return None
# Find download links download_url = None for link in soup.find_all('a', href=True): href = link['href'].lower() if any(ext in href for ext in ['.exe', '.bin', '.rfu', '.zip', 'download']): if 'hp.com' in href: download_url = link['href'] break download hp easy firmware upgrade utility
# Get context (100 chars before/after) start = max(0, match.start() - 100) end = min(len(text), match.end() + 100) context = text[start:end].strip() # Pattern for the specific phrase pattern =