help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regular expression match


From: Kevin Rodgers
Subject: Re: Regular expression match
Date: Thu, 05 Nov 2009 07:22:41 -0700
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)

Pascal J. Bourguignon wrote:
Qiang <address@hidden> writes:

Hi

I am trying to use regular expression in Emacs. And I have
question about how to return the matched item. For example,
I want to match and return '8' in the string 'Vol.8'. How
can I achieve that ?

Using groups and match-string.  For example:

(when (re-search-forward "Vol.\(8\)")
   (match-string 1))

The regexp string should be "Vol\\.\\(8\\)"

--
Kevin Rodgers
Denver, Colorado, USA





reply via email to

[Prev in Thread] Current Thread [Next in Thread]