branch: externals/consult-recoll
commit 204a936c5b29334a3b40042ff5047f5790a7c136
Author: jao <j...@gnu.org>
Commit: jao <j...@gnu.org>

    fix: a better regexp for decomposing recollq results
    
    cf. discussion in issue #3
---
 consult-recoll.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/consult-recoll.el b/consult-recoll.el
index aba5b1ac49..93b3eadc72 100644
--- a/consult-recoll.el
+++ b/consult-recoll.el
@@ -86,9 +86,12 @@ Set to nil to use the default 'title (path)' format."
   (setq consult-recoll--current text)
   `("recollq" ,@consult-recoll-search-flags ,text))
 
+(defconst consult-recoll--line-rx "^\\(.*?\\)\t\\[\\(.*?\\)\\]\t\\[\\(.*\\)\\]"
+  "Regular expression decomposing result lines returned by recollq")
+
 (defun consult-recoll--transformer (str)
   "Decode STR, as returned by recollq."
-  (when (string-match "^\\([^[]+\\)\t\\[\\([^]]+\\)\\]\t\\[\\([^[]+\\)\\]" str)
+  (when (string-match consult-recoll--line-rx str)
     (let* ((mime (match-string 1 str))
            (url (match-string 2 str))
            (title (match-string 3 str))

Reply via email to