Extracts text between two markers in a string.
(text, start_marker, end_marker)
| 132 | |
| 133 | |
| 134 | def extract_between(text, start_marker, end_marker): |
| 135 | """Extracts text between two markers in a string.""" |
| 136 | # print('Calling extract_between:', start_marker, end_marker) |
| 137 | |
| 138 | pattern = re.escape(end_marker[::-1]) + r"(.*?)" + re.escape(start_marker[::-1]) |
| 139 | matches = re.findall(pattern, text[::-1], flags=re.DOTALL) |
| 140 | |
| 141 | if matches: |
| 142 | # print('Extracted text:', matches[0][::-1].strip()) |
| 143 | return matches[0][::-1].strip() |
| 144 | print('No matches found') |
| 145 | return None |
| 146 | |
| 147 | def format_search_results(relevant_info: List[Dict]) -> str: |
| 148 | """Format search results into a readable string""" |
no outgoing calls
no test coverage detected