Return the first non-empty capture group for a regex search.
(pattern: str, text: str)
| 595 | |
| 596 | |
| 597 | def _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 | |
| 608 | def _build_scholar_profile_url( |
no outgoing calls
no test coverage detected