MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / _extract_first_group

Function _extract_first_group

agents/coldstart-agent/main.py:597–605  ·  view source on GitHub ↗

Return the first non-empty capture group for a regex search.

(pattern: str, text: str)

Source from the content-addressed store, hash-verified

595
596
597def _extract_first_group(pattern: str, text: str) -> str:
598 """Return the first non-empty capture group for a regex search."""
599 match = re.search(pattern, text or "", re.IGNORECASE | re.DOTALL)
600 if not match:
601 return ""
602 for group in match.groups():
603 if group:
604 return group
605 return match.group(0)
606
607
608def _build_scholar_profile_url(

Calls

no outgoing calls

Tested by

no test coverage detected