From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.help Subject: Re: Regex to match "define ABC-123-xyz" Date: Fri, 01 Oct 2010 14:26:04 +0200 Organization: Organization?!? Message-ID: <87fwwqhzfn.fsf@lola.goethe.zz> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1291867189 2354 80.91.229.12 (9 Dec 2010 03:59:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 9 Dec 2010 03:59:49 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 09 04:59:45 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PQXfU-0008WF-Sc for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 04:59:45 +0100 Original-Received: from localhost ([127.0.0.1]:44967 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQXfU-0003Tr-2G for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 22:59:44 -0500 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!kanaga.switch.ch!news-zh.switch.ch!switch.ch!news.belwue.de!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help X-Face: 2FEFf>]>q>2iw=B6, xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN; i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:4Hv99Ujbisms9DsdXe+XK1mOjMs= Original-Lines: 25 Original-NNTP-Posting-Date: 01 Oct 2010 14:26:05 CEST Original-NNTP-Posting-Host: ad327cd9.newsspool2.arcor-online.net Original-X-Trace: DXC=O6bI9U_fR\OFJ3]dH>I?oEA9EHlD; 3YcB4Fo<]lROoRA8kF5MOK`al0oRJ:TVX]XHoY:LWISPGHR:bEM Original-X-Complaints-To: usenet-abuse@arcor.de Original-Xref: usenet.stanford.edu gnu.emacs.help:181583 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:76600 Archived-At: Gary writes: > I'm having trouble with this, to say the least. "Obviously" the parts > after the define aren't fixed, either in content or position. What I > have tried is > > define [A-Za-z0-9_-]+ > > (that is, match the string "define", followed by a single space, > followed by some string consisting of letters and numbers plus "_" and > "-") which works except... it doesn't match the numeric part(s). I can > see this in the regexp builder, and, since I am attempting to match part > of a programming language syntax, in source code. Kind of > confusing. What have I done wrong, please? I don't see your problem. Care to give a reproducible recipe? If I do M-: (progn (string-match "define [A-Za-z0-9_-]+" "define ABC-123-xyz") (match-end 0)) I get 18, as expected. -- David Kastrup