From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Regexp problem: org-mode and remind integration Date: Sat, 17 Jan 2009 09:16:11 +0100 Message-ID: <1470EAA2-3451-48DA-B3C8-7AECD83E2B82@uva.nl> References: <6ac505ad0901131805j2cb519c9i680e3a783422e753@mail.gmail.com> Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: multipart/mixed; boundary="===============1978612512==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LO6Lr-00051g-Ss for emacs-orgmode@gnu.org; Sat, 17 Jan 2009 03:16:19 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LO6Lp-00051U-Ds for Emacs-orgmode@gnu.org; Sat, 17 Jan 2009 03:16:18 -0500 Received: from [199.232.76.173] (port=41672 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LO6Lp-00051R-8M for Emacs-orgmode@gnu.org; Sat, 17 Jan 2009 03:16:17 -0500 Received: from mx20.gnu.org ([199.232.41.8]:52394) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LO6Lo-0006UY-M8 for Emacs-orgmode@gnu.org; Sat, 17 Jan 2009 03:16:16 -0500 Received: from nf-out-0910.google.com ([64.233.182.184]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LO6Ln-0008OP-J7 for Emacs-orgmode@gnu.org; Sat, 17 Jan 2009 03:16:15 -0500 Received: by nf-out-0910.google.com with SMTP id c7so306662nfi.26 for ; Sat, 17 Jan 2009 00:16:14 -0800 (PST) In-Reply-To: <6ac505ad0901131805j2cb519c9i680e3a783422e753@mail.gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Daniel Martins Cc: bastien.guerry@ens.fr, Emacs-orgmode@gnu.org --===============1978612512== Content-Type: multipart/alternative; boundary=Apple-Mail-8-469901606 --Apple-Mail-8-469901606 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On Jan 14, 2009, at 3:05 AM, Daniel Martins wrote: > Sorry for the confusion, > > I did try the empty regexp as suggested and it "worked" ie no > problem appeared. > > My problem is to find a regexp for timestamps outside DEADLINE: and > SCHEDULE: rows > > In other words, given three variables A B C with regexps. > > If I have a regexp given by variable A and I want to find a text > which satisfies A but DO NOT satisfy B nor C how can I write uch > regexp? You cannot. The only way is to first find A, then remember your position and look around the match to make sure that the location does not also match the others. For example: (let (tmp-string) (while (re-search-forward "<.*?>" nil t) ;; we have a match of something between angular brackets ;; now grab a string before the beginning of the match (setq tmp-string (buffer-substring (max (point-min) (- (match-beginning 0) 20)) (match-beginning 0))) ;; no check if this string contains DEADLINE of SCHEDULED (when (save-match-data ;; to not loose the info about the original match (and (not (string-match "DEADLINE:") tmp-string) (not (string-match "SCHEDULED:") tmp-string))) ;; ok, this is one of the locations we wanted ...... HTH - Carsten > > > 2009/1/13 Olaf Dietsche > "Daniel Martins" writes: > > > I did your test wuth a null regexp > > > > It is a regexp problem! > > > > Org-mode has two variables: org-deadline-string and org-scheduled- > string > > (see below) > > > > and I want to match tasks which have a timestamp, ie satisfies the > > org-ts-regexp2 > > > > BUT DO NOT have org-deadline-string NOR org-scheduled-string > > > > I tried > > > > (org2rem-pure-timestamps-string > > (concat "\\(" org-deadline-string "\\|" > > org-scheduled-string "\\)\\{0\\}")) > > > > in order that a regexp such as > > > > "\\(org-deadline-string\\|org-scheduled-string\\)\\{0\\}" > > > > would match only zero {0} occurrences of > > (org-deadline-string|org-scheduled-string) > > but this seems to be a mistake. > > > > Any hint?? > > I can only suggest the empty regexp, as before: > > (org2rem-pure-timestamps-string "") > > If this doesn't work, I don't know. > > Regards, Olaf > --Apple-Mail-8-469901606 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable
On Jan 14, 2009, = at 3:05 AM, Daniel Martins wrote:

Sorry for = the confusion,

I did try the empty regexp as suggested and it = "worked" ie no problem appeared.

My problem is to find a regexp = for timestamps outside DEADLINE: and SCHEDULE: rows

In other = words, given three variables A B C with regexps.

If I have a = regexp given by variable A and I want to find a text which satisfies A = but DO NOT satisfy B nor C how can I write uch = regexp?


You cannot. =  The only way is to first find A, then remember
your = position and look around the match to make sure that = the
location does not also match the = others.

For = example:

(let = (tmp-string)
  (while (re-search-forward "<.*?>" = nil t)
    ;; we have a match of something = between angular brackets
    ;; now grab a = string before the beginning of the match
   =  (setq tmp-string (buffer-substring
=      (max (point-min) (- (match-beginning 0) = 20))
=      (match-beginning = 0)))
    ;; no check if this string contains = DEADLINE of SCHEDULED
    (when = (save-match-data ;; to not loose the info about the original = match
=    (and (not (string-match "DEADLINE:") = tmp-string)
(not (string-match = "SCHEDULED:") tmp-string)))
      ;; ok, = this is one of the locations we wanted
     = ......


HTH

- Carsten



2009/1/13 Olaf Dietsche <olaf+list.orgmode@olaf= dietsche.de>
"Daniel Martins" <danielemc@gmail.com> writes:
=
> I did your test wuth a null = regexp
>
> It is a regexp problem!
>
> Org-mode has two = variables: org-deadline-string and org-scheduled-string
> (see = below)
>
> and I want to match tasks which have a timestamp, ie = satisfies the
> org-ts-regexp2
>
> BUT DO NOT  have = org-deadline-string NOR org-scheduled-string
>
> I tried
= >
>     (org2rem-pure-timestamps-string
>   =         (concat  "\\(" org-deadline-string = "\\|"
>               =  org-scheduled-string  "\\)\\{0\\}"))
>
> in order = that a regexp such as
>
> = "\\(org-deadline-string\\|org-scheduled-string\\)\\{0\\}"
>
> = would match only zero {0} occurrences of
> = (org-deadline-string|org-scheduled-string)
> but this seems to be a = mistake.
>
> Any hint??

I can only suggest the = empty regexp, as before:

    = (org2rem-pure-timestamps-string "")

If this doesn't work, I = don't know.

Regards, Olaf
=


= --Apple-Mail-8-469901606-- --===============1978612512== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============1978612512==--