Skip to content

Commit 8bbf307

Browse files
committed
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
1 parent 7baeb18 commit 8bbf307

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lightrag/operate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ async def _parse_extraction_result(
835835
[context_base["record_delimiter"], context_base["completion_delimiter"]],
836836
)
837837
for record in records:
838-
record = re.search(r"\((.*?)\)", record)
838+
record = re.search(r"\((.*)\)", record, re.DOTALL)
839839
if record is None:
840840
continue
841841
record = record.group(1)
@@ -1749,7 +1749,7 @@ async def _process_extraction_result(
17491749
)
17501750

17511751
for record in records:
1752-
record = re.search(r"\((.*?)\)", record)
1752+
record = re.search(r"\((.*)\)", record, re.DOTALL)
17531753
if record is None:
17541754
continue
17551755
record = record.group(1)

0 commit comments

Comments
 (0)