|
From: | Kevin Rodgers |
Subject: | Re: How to check regexp for syntax-errors? (There HAS to be SOME way, yes?) |
Date: | Tue, 20 Oct 2009 01:54:56 -0600 |
User-agent: | Thunderbird 2.0.0.23 (Macintosh/20090812) |
David Combs wrote:
Isn't there some .el that that will try to parse a regexp, and tell me where it got confused, and what to look for for errors?
(defun valid-regexp-p (regexp) (interactive "sRegexp: ") (with-temp-buffer (condition-case error-data (progn (re-search-forward regexp nil t) t) (invalid-regexp (when (interactive-p) (message "Invalid regexp: %s" (cdr error-data))) nil)))) -- Kevin Rodgers Denver, Colorado, USA
[Prev in Thread] | Current Thread | [Next in Thread] |