emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <dominik@science.uva.nl>
To: Daniel Martins <danielemc@gmail.com>
Cc: bastien.guerry@ens.fr, Emacs-orgmode@gnu.org
Subject: Re: Regexp problem: org-mode and remind integration
Date: Sat, 17 Jan 2009 09:16:11 +0100	[thread overview]
Message-ID: <1470EAA2-3451-48DA-B3C8-7AECD83E2B82@uva.nl> (raw)
In-Reply-To: <6ac505ad0901131805j2cb519c9i680e3a783422e753@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2326 bytes --]


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
>


[-- Attachment #1.2: Type: text/html, Size: 3816 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

      reply	other threads:[~2009-01-17  8:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-14  2:05 Regexp problem: org-mode and remind integration Daniel Martins
2009-01-17  8:16 ` Carsten Dominik [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1470EAA2-3451-48DA-B3C8-7AECD83E2B82@uva.nl \
    --to=dominik@science.uva.nl \
    --cc=Emacs-orgmode@gnu.org \
    --cc=bastien.guerry@ens.fr \
    --cc=danielemc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).