From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id INU/EYdpxF9uXgAA0tVLHw (envelope-from ) for ; Mon, 30 Nov 2020 03:39:51 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id QI3zDIdpxF9lewAAbx9fmQ (envelope-from ) for ; Mon, 30 Nov 2020 03:39:51 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id BE573940485 for ; Mon, 30 Nov 2020 03:39:50 +0000 (UTC) Received: from localhost ([::1]:41272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kja2X-0008D8-6v for larch@yhetil.org; Sun, 29 Nov 2020 22:39:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kja1x-0008Cn-T6 for emacs-orgmode@gnu.org; Sun, 29 Nov 2020 22:39:13 -0500 Received: from out0.migadu.com ([2001:41d0:2:267::]:4840) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kja1u-0000lN-S4 for emacs-orgmode@gnu.org; Sun, 29 Nov 2020 22:39:13 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1606707584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tXhqssrXlwb7XWZj7cNsDT8kWT2GXWZX+43Oh02NWHo=; b=rxbjNMoroIsD9YQpSWb8QnFOD7twgiNop4y/gPdsG/b9MhFpP53KW8jqwLKRwkIEzDtREM drvC2YjrfkKQ7Tkbm8D5ZLRgmiGy41de4P6bHxQSfynvLBHJllOOcTa+iHPX/KlE8+3YAh LNkQc1lq5OLj0GFqnpBKFeWgcrQG8/rYv4AZF/NcmpY/x6vD3XODuVmPOP2278raxwxHyq d4SO3RXu/aX+VrI1dLp6rIbZX+g4H5aEytPU9OrnAcrdjCUZWjwez0VEAjjbrZNylSyBbe u3Rk3A+3hTm4jC1WNAHIFK9jayMMCL0IMpRi97uRyWiZxGckXB7EwGD8RQ7fbA== From: Kyle Meyer To: Ian Garmaise Subject: Re: difficulty extracting email address from property field containing gmail link In-Reply-To: References: Date: Sun, 29 Nov 2020 22:39:04 -0500 Message-ID: <87czzvqzs7.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Auth-User: kyle@kyleam.com Received-SPF: pass client-ip=2001:41d0:2:267::; envelope-from=kyle@kyleam.com; helo=out0.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.48 X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=kyleam.com header.s=key1 header.b=rxbjNMor; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-TUID: Kvind3gyrfnq Ian Garmaise writes: > This is working well, except for the property used for the email address. > Unfortunately, I stored this as a gmail link. This makes it difficult to > extract the actual email address using org-collector as follows: > > #+BEGIN: propview :cols ((car (s-split " " ITEM)) EMAIL_ADDRESS) :id > "candidates" :match "testthis" :wrap example > > the result produced looks like this: > > | (car (s-split " " ITEM)) | EMAIL_ADDRESS | > |--------------------------+---------------------------------------------------------------------------------| > | "Ciara" | [[https://mail.google.com/mail/?view=cm&fs=1&to=ciaraxyz@gmail\.com]] | > | "Duncan" | [[https://mail.google.com/mail/?view=cm&fs=1&to=duncanxyz@indeedemail\.com]] | > > I have looked at several methods that I found on the web to extract the > email address from the link in the property, but haven't yet found a > solution that I could get to work. Still building up my elisp skillset, > would appreciate suggestions. I've never used org-collector, but quickly trying to wire up a function to extract the email part of the text you show, I suspect some of the trouble you're having is that the value comes in as a vector because org-propview-collect processes it with org-babel-read. So perhaps something like this would get you on the right track: (require 'subr-x) (defun my/extract-email-from-link (value) (setq value (format "%S" value)) (when-let ((link (and (string-match org-link-bracket-re value) (org-link-unescape (match-string-no-properties 1 value))))) (thread-last link (replace-regexp-in-string (rx string-start (one-or-more not-newline) "to=" (group (one-or-more not-newline)) string-end) "\\1") (replace-regexp-in-string (rx "\\.") ".")))) --8<---------------cut here---------------start------------->8--- #+BEGIN: propview :cols ((car (s-split " " ITEM)) (my/extract-email-from-link EMAIL_ADDRESS)) :id global | (car (s-split " " ITEM)) | (my/extract-email-from-link EMAIL_ADDRESS) | |--------------------------+--------------------------------------------| | "Ciara" | "ciaraxyz@gmail.com" | | "Duncan" | "duncanxyz@indeedemail.com" | |--------------------------+--------------------------------------------| | | | #+END: * Ciara :PROPERTIES: :EMAIL_ADDRESS: [[https://mail.google.com/mail/?view=cm&fs=1&to=ciaraxyz@gmail\.com]] :END: * Duncan :PROPERTIES: :EMAIL_ADDRESS: [[https://mail.google.com/mail/?view=cm&fs=1&to=duncanxyz@indeedemail\.com]] :END: --8<---------------cut here---------------end--------------->8---