From 7baeb186c6ea9d0bf535f7236928e3b6e6570925 Mon Sep 17 00:00:00 2001 From: yangdx Date: Mon, 1 Sep 2025 10:10:45 +0800 Subject: [PATCH] Fix regex to use non-greedy matching for parentheses extraction --- lightrag/operate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lightrag/operate.py b/lightrag/operate.py index 88bb7349..0cf1248e 100644 --- a/lightrag/operate.py +++ b/lightrag/operate.py @@ -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) 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) if record is None: continue record = record.group(1)