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@olafdietsche.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