[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Whitespace search and regex.c
From: |
Stefan Monnier |
Subject: |
Re: Whitespace search and regex.c |
Date: |
Fri, 26 Nov 2004 17:12:25 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) |
>> It is for the sake of user-level search features that
>> want a series of SPCs to stand for some broader kind of whitespace.
> I'm afraid that doesn't tell me really what it is for. I.e. why is it
> implemented this way rather than some other way? What was the
> precise goal?
> This was the easiest way I could find to do it reliably.
> It avoids the need to write other code to parse a regexp.
> I did not want to do that; I figured it would be a pain.
Well, another easy way goes as follows:
(defun in-brackets-p (regex pos)
"Return non-nil if POS is within brackets in REGEX."
(condition-case err
(progn
(string-match (substring regex 0 pos) "")
nil)
(error (equal (cadr err) "Unmatched [ or [^"))))
-- Stefan