if not match: return None
# 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) 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() if not match: return None # Pattern for