From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Strey Subject: Re: phone links... Date: Thu, 4 Apr 2013 15:55:46 +0200 Message-ID: <20130404135546.GE3245@strey.biz> References: <5156228C.4010400@sift.info> <20130403145208.GC3245@strey.biz> <515C4555.8010309@sift.net> <20130404082653.GD3245@strey.biz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([208.118.235.92]:37829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNkdx-0002jH-Qx for emacs-orgmode@gnu.org; Thu, 04 Apr 2013 09:56:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNkdr-0005w1-T7 for emacs-orgmode@gnu.org; Thu, 04 Apr 2013 09:55:57 -0400 Received: from mx1.supremebox.com ([198.23.53.39]:52772) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNkdr-0005vw-FV for emacs-orgmode@gnu.org; Thu, 04 Apr 2013 09:55:51 -0400 Content-Disposition: inline In-Reply-To: <20130404082653.GD3245@strey.biz> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: Robert Goldman On Thu, Apr 04, 2013 at 10:26:53AM +0200, Michael Strey wrote: [...] > Usually my phone links look like [[tel:+49 351 4129535]]; but since I > imported data sets from a larger contact data base that had evolved over > time, I ended up with stuff like this in my data base: > 1. [[tel:0033 (0) 4568-33]] > 2. [[tel:+49 (0)3 8899 66]] > 3. [[tel:0351 41295-35]] > 4. [[tel:0351/4129535]] > 5. [[tel:(0351) 412 95-35]] > > My filter function currently handles the cases 1. to 4. but (for no > other reason than carelessness) not 5. [...] Here is a re-work of the filter function that handles all off the above cases correctly. #+BEGIN_SRC emacs-lisp (defun trim-phone-number (phonenumber) "Remove whitespaces from a telephone number" (setq trimmed_phonenumber (mapconcat 'identity (split-string (mapconcat 'identity (split-string phonenumber "(0)") "") "[()/ -]") ""))) #+END_SRC I'm a Elisp newbie. I'm sure that there are smarter solutions to solve this problem. Regards -- Michael Strey www.strey.biz