import re def extract_value(patterns: list, primary_source: str, secondary_source: str, default='Not Defined') -> str: for source in (primary_source, secondary_source): for pattern in patterns: matches = re.findall(pattern, source, re.IGNORECASE) if matches: return matches[0] # Return the first match immediately return default # Return default if no matches are found