lwant's picture
rework prompts
cfb1f9f
raw
history blame
214 Bytes
import re
def extract_pattern(pattern: str, text: str) -> str | None:
matches = re.findall(pattern, text)
if matches:
extracted = matches[-1]
return extracted
else:
return None