all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Rodney Sparapani <rsparapa@mcw.edu>
Subject: Re: On refining regexp by adding exceptions systematically
Date: Mon, 07 Oct 2002 09:13:48 -0500	[thread overview]
Message-ID: <3DA1969C.60805@mcw.edu> (raw)
In-Reply-To: tvikna.obd.ln@lart.ca

Sorry, I missed the original post.  I wanted the same functionality from 
regexps myself. However, after I realized that regexps alone would not 
do it, I wrote the following routine in elisp for ESS.  Enjoy.

(defun ess-search-except (regexp &optional except backward)
"Search for a regexp, store as match 1, optionally ignore strings that 
match exceptions."
    (interactive)
   
    (let ((continue t) (exit nil))

    (while continue
    (if (or (and backward (search-backward-regexp regexp nil t))
                (and (not backward) (search-forward-regexp regexp nil 
t))) (progn
        (setq exit (match-string 1))
            (setq continue (and except (string-match except exit)))
        (if continue (setq exit nil)))
        ;else
        (setq continue nil)))

    exit))

-- 
Rodney Sparapani              Medical College of Wisconsin
Sr. Biostatistician           Patient Care & Outcomes Research
rsparapa@mcw.edu              http://www.mcw.edu/pcor
Was 'Name That Tune' rigged?  WWLD -- What Would Lombardi Do

  parent reply	other threads:[~2002-10-07 14:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-03 12:27 On refining regexp by adding exceptions systematically gnuist
2002-10-03 18:38 ` Kaz Kylheku
2002-10-03 23:04   ` Kaz Kylheku
     [not found]   ` <tvikna.obd.ln@lart.ca>
2002-10-07 14:13     ` Rodney Sparapani [this message]
2002-10-05 13:31 ` Alan Mackenzie
2002-10-05 16:11   ` Stefan Monnier <foo@acm.com>
2002-10-05 17:45     ` Alan Mackenzie
2002-10-06  3:02   ` Vassil Nikolov
2002-10-06  7:48     ` Alan Mackenzie
2002-10-05 19:46 ` Christopher Browne

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

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

  git send-email \
    --in-reply-to=3DA1969C.60805@mcw.edu \
    --to=rsparapa@mcw.edu \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.