Fix regex to match multiline content in extraction parsing

• Remove non-greedy quantifier
• Add DOTALL flag for multiline matching
• Apply to both parsing functions
• Enable cross-line content extraction
This commit is contained in:
yangdx 2025-09-01 10:35:06 +08:00
parent 7baeb186c6
commit 8bbf307aeb

View file

@ -835,7 +835,7 @@ async def _parse_extraction_result(
[context_base["record_delimiter"], context_base["completion_delimiter"]],
)
for record in records:
record = re.search(r"\((.*?)\)", record)
record = re.search(r"\((.*)\)", record, re.DOTALL)
if record is None:
continue
record = record.group(1)
@ -1749,7 +1749,7 @@ async def extract_entities(
)
for record in records:
record = re.search(r"\((.*?)\)", record)
record = re.search(r"\((.*)\)", record, re.DOTALL)
if record is None:
continue
record = record.group(1)