From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim Johnson Newsgroups: gmane.emacs.help Subject: Re: Regexp to find second of three words Date: Tue, 08 Aug 2006 15:51:31 -0000 Organization: Alaska Internet Solutions Message-ID: References: Reply-To: tim@johnsons-web.com NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1155055261 28324 80.91.229.2 (8 Aug 2006 16:41:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 8 Aug 2006 16:41:01 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 08 18:40:50 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GAUcy-0003et-95 for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Aug 2006 18:40:24 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GAUcx-00088q-Nl for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Aug 2006 12:40:23 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!tethys.csu.net!nntp.csufresno.edu!sn-xt-sjc-03!sn-xt-sjc-11!sn-xt-sjc-09!sn-post-sjc-01!supernews.com!news.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: slrn/0.9.8.0 (Linux) Original-X-Complaints-To: abuse@supernews.com Original-Lines: 48 Original-Xref: shelby.stanford.edu gnu.emacs.help:140942 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:36567 Archived-At: On 2006-08-07, Eric Hanchrow wrote: Hi Eric: In rebol, which has some lispish features, subroutines are values, not immutable parts of the language syntax. And can have different rules (think pascal, => function vs. procedure) And a subroutine can be created by the 'set function as in set 'printf def[ ; arguments ][;code here. variables are automatically local ] or set 'printf function[ ; arguments ][; local variable declared here and initialized to 'none ][;code here ] I solved this after getting away from the computer for a while. :-) (defconst rebol-find-set-function-regexp (concat "set[ ]+'\\(\\<[A-Za-z0-9*-_.]+\\)[ ]\\(" ;; ^ word boundary rebol-function-names-regexp "\\)\\>") "Regexp to find functions defined by the 'set function.") ;; by placing a word boundary before the character class > I probably misunderstand what you're trying to do with the stuff that > begins with \\(d\\(?:ef, but I imagine you'll be able to correct what created by regexp-opt > I've got. > > (let ((p (rx "set" > (one-or-more space) "'" (group (one-or-more (or alnum (any "*-_.")))) > (one-or-more space) (or "def" "does" "func" "function" "has" "lfinc" "sub"))) > (input "set 'printf function")) > > (string-match p input) > (match-string 1 input)) Very interesting. This is a very different approach. I will have to try to absorb it. I think I am about to be enlighted. Thanks very much for that example! cheers tim -- Tim Johnson http://www.alaska-internet-solutions.com