From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id OxIZDe3qxF8fOwAA0tVLHw (envelope-from ) for ; Mon, 30 Nov 2020 12:51:57 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 4AJ+CO3qxF+NYwAA1q6Kng (envelope-from ) for ; Mon, 30 Nov 2020 12:51:57 +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 AAE719400CB for ; Mon, 30 Nov 2020 12:51:55 +0000 (UTC) Received: from localhost ([::1]:58086 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kjien-0005GL-7J for larch@yhetil.org; Mon, 30 Nov 2020 07:51:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kjiUa-00070U-Nr for emacs-orgmode@gnu.org; Mon, 30 Nov 2020 07:41:20 -0500 Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]:34266) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kjiUX-0006w1-V4 for emacs-orgmode@gnu.org; Mon, 30 Nov 2020 07:41:20 -0500 Received: by mail-qk1-x72b.google.com with SMTP id n132so10589318qke.1 for ; Mon, 30 Nov 2020 04:41:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=phorixsol.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=tL4bD+NGD3OtPvohPQQTcEfI75GGl2dx6xMdxKFf050=; b=SUSIVhSRvwUcXAz28J+qG7jfRYZinSQiUTUU6UF7kJR4b/2eEacocbq+JTwPiwRDDT fjm4w/apkkSh3YCwY47Qq/gXqeLuY7pqHXRou7+txrTNehRa+heHF3qk0IW5K53e4S/J fIF3b3gh41aZSPiTYRBqfsd78HMV5ibQ4p/9A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=tL4bD+NGD3OtPvohPQQTcEfI75GGl2dx6xMdxKFf050=; b=DwOztM1U5WMEZ8jDhURJp99SO2kZg8ydK8D2HeO6kWpWTaOH63kDse256PIINso8GM 61PDL/lfHzawbAODpKv4m8Qch9CuoNYW6UT5Wd/yEAPzj1BoecrkBDII9LUwSlGuK+Cq zDwx8zmT4cutItN6hAed/ks11OesSmQw7UXXQMzlhfl8F89MrGvJLHXjTtB1jB6X5qxr kUNFXeR9pmsyTahXIqTaXwPorBMsEZaSBYIAC7thWq7nBuHPxN1mFe5tw1E/BGRz/3WA B6JEdGOEH5cdDSadT0xZoj9O54OsZiFsZdFaGAPOLBYVoEz12uSTBYvcpqI5Qf0pvcli 4lOg== X-Gm-Message-State: AOAM531A/HsYvB4zMm42q5TM2rbzyUliRzfjlyR9lCyp7CrF/xVtt5A1 taovM70F8iWTAnG2lpNnZRHygITFfXUK7iYYqZ7jj1cOAWIhaMzZ X-Google-Smtp-Source: ABdhPJxOYFh1e3gk4YZexBvBP5Zb6+RtceCyQ7knv5f0uLDRwhSV1YYR6WXTO8OvoC4JKj/TRnFcHfn6+1stzAAqv4w= X-Received: by 2002:a37:9b0b:: with SMTP id d11mr22006326qke.129.1606740076332; Mon, 30 Nov 2020 04:41:16 -0800 (PST) MIME-Version: 1.0 References: <87czzvqzs7.fsf@kyleam.com> In-Reply-To: <87czzvqzs7.fsf@kyleam.com> From: Ian Garmaise Date: Mon, 30 Nov 2020 07:41:06 -0500 Message-ID: Subject: Re: difficulty extracting email address from property field containing gmail link To: emacs-orgmode Content-Type: multipart/alternative; boundary="0000000000007f1df305b5525309" Received-SPF: pass client-ip=2607:f8b0:4864:20::72b; envelope-from=ian.g@phorixsol.com; helo=mail-qk1-x72b.google.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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -3.42 X-Spam-Score: -3.42 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=phorixsol.com header.s=google header.b=SUSIVhSR; dmarc=pass (policy=none) header.from=phorixsol.com; 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-Migadu-Scanner: ns3122888.ip-94-23-21.eu X-TUID: 248/Da3sxVsJ --0000000000007f1df305b5525309 Content-Type: text/plain; charset="UTF-8" Thanks Kyle, got it to work this way: #+BEGIN: propview :cols ((car (s-split " " ITEM)) (s-chop-prefix "gmail:" (my/extract-email-from-link EMAIL_ADDRESS))) :id "candidates" :match "testthis" :wrap example | (car (s-split " " ITEM)) | (s-chop-prefix "gmail:" (my/extract-email-from-link EMAIL_ADDRESS)) | |--------------------------+---------------------------------------------------------------------| | "Ciara" | "ciaraxxxx@gmail.com" | | "Duncan" | "duncanxxxx@indeedemail.com" | Thanks a million! Ian On Sun, Nov 29, 2020 at 10:39 PM Kyle Meyer wrote: > 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--- > -- ===== Ian Garmaise Consultant Phorix Solutions Group ian.g@phorixsol.com Toronto cell: 416.432.2251 NYC: 917.512.9535 https://www.linkedin.com/in/igarmaise/ http://www.PhorixSol.com --0000000000007f1df305b5525309 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks Kyle, got it to work this way:

#+BEGIN: propview :cols ((car (s-split " &quo= t; ITEM)) =C2=A0(s-chop-prefix "gmail:" (my/extract-email-from-li= nk EMAIL_ADDRESS))) =C2=A0:id "candidates" :match "testthis&= quot; :wrap example
| (car (s-split " " ITEM)) | (s-chop-prefi= x "gmail:" (my/extract-email-from-link EMAIL_ADDRESS)) |
|----= ----------------------+----------------------------------------------------= -----------------|
| "Ciara" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| "ciaraxxxx@gmail.com" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|
| "Duncan" =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | "duncanxxxx@indeedemail.com" =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|

Thanks a million!

Ian


On Sun, Nov 29, 2020 at 10:39 PM Kyle Meyer <kyle@kyleam.com> wrote:
Ian Garmaise writes:

> This is working well, except for the property used for the email addre= ss.
> Unfortunately, I stored this as a gmail link.=C2=A0 This makes it diff= icult to
> extract the actual email address using org-collector as follows:
>
> #+BEGIN: propview :cols ((car (s-split " " ITEM))=C2=A0 EMAI= L_ADDRESS)=C2=A0 :id
> "candidates" :match "testthis" :wrap example
>
> the result produced looks like this:
>
> | (car (s-split " " ITEM)) | EMAIL_ADDRESS=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|<= br> > |--------------------------+------------------------------------------= ---------------------------------------|
> | "Ciara"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 | [[h= ttps://mail.google.com/mail/?view=3Dcm&fs=3D1&to=3Dciaraxyz@gmail\.= com]]=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|
> | "Duncan"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0| [[https://mail.google.com/mail/?view=3Dcm&fs=3D1&to=3Dduncanxyz= @indeedemail\.com]] |
>
> I have looked at several methods that I found on the web to extract th= e
> email address from the link in the property, but haven't yet found= a
> solution that I could get to work.=C2=A0 Still building up my elisp sk= illset,
> 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.=C2=A0 So perhaps
something like this would get you on the right track:

=C2=A0 (require 'subr-x)

=C2=A0 (defun my/extract-email-from-link (value)
=C2=A0 =C2=A0 (setq value (format "%S" value))
=C2=A0 =C2=A0 (when-let ((link (and (string-match org-link-bracket-re value= )
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 (org-link-unescape
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(match-string-no-properties 1 value)))))
=C2=A0 =C2=A0 =C2=A0 (thread-last
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 link
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (replace-regexp-in-string
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(rx string-start (one-or-more not-newline= ) "to=3D"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(group (one-or-more not-new= line)) string-end)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"\\1")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (replace-regexp-in-string (rx "\\.") = "."))))


--8<---------------cut here---------------start------------->8---
#+BEGIN: propview :cols ((car (s-split " " ITEM)) (my/extract-ema= il-from-link EMAIL_ADDRESS)) :id global
| (car (s-split " " ITEM)) | (my/extract-email-from-link EMAIL_AD= DRESS) |
|--------------------------+--------------------------------------------| | "Ciara"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 | "ciar= axyz@gmail.com"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|
| "Duncan"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0| "duncanxyz@indeedemail.com"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 |
|--------------------------+--------------------------------------------| |=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 |
#+END:

* Ciara
:PROPERTIES:
:EMAIL_ADDRESS: [[h= ttps://mail.google.com/mail/?view=3Dcm&fs=3D1&to=3Dciaraxyz@gmail\.= com]]
:END:

* Duncan
:PROPERTIES:
:EMAIL_ADDRESS: [[https://mail.google.com/mail/?view=3Dcm&fs=3D1&to=3Dduncanxyz= @indeedemail\.com]]
:END:
--8<---------------cut here---------------end--------------->8---


--
=3D=3D=3D=3D=3D
Ian Garmaise
ConsultantPhorix Solutions Group
ian.g@phorixsol.com
Toronto cell: 416.432.2251
NYC: 917.= 512.9535

https://www.linkedin.com/in/igarmaise/

http://www.PhorixSol.com --0000000000007f1df305b5525309--