From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Pascal Bourguignon Newsgroups: gmane.emacs.help Subject: Re: match string to regexp Date: 21 Nov 2003 07:56:16 +0100 Organization: [posted via Easynet Spain] Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87ptfmmcq7.fsf@thalassa.informatimago.com> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1069398165 10344 80.91.224.253 (21 Nov 2003 07:02:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 21 Nov 2003 07:02:45 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 21 08:02:42 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AN5JR-0000em-00 for ; Fri, 21 Nov 2003 08:02:41 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AN6Df-0004Hw-J8 for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Nov 2003 03:00:47 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!diablo.theplanet.net!colt.net!easynet-quince!easynet.net!easynet-post2!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Original-Lines: 34 Original-NNTP-Posting-Host: 62.93.174.79 Original-X-Trace: DXC=G]1B>X?b<57]=NTOD;8RO:N[]a?6B>:P3bBd4DjF1d]1 Original-Xref: shelby.stanford.edu gnu.emacs.help:118520 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:14461 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:14461 Jesper Harder writes: > Miguel Frasson writes: > > > How to match a string against a regexp? The string is returned by > > some function like (match-string N). > > ,----[ C-h f string-match RET ] > | string-match is a built-in function. > | (string-match REGEXP STRING &optional START) > | > | Return index of start of first match for REGEXP in STRING, or nil. > | Case is ignored if `case-fold-search' is non-nil in the current buffer. > | If third arg START is non-nil, start search at that index in STRING. > | For index of first char beyond the match, do (match-end 0). > | `match-end' and `match-beginning' also give indices of substrings > | matched by parenthesis constructs in the pattern. > | > | You can use the function `match-string' to extract the substrings > | matched by the parenthesis constructions in REGEXP. > `---- Time flies like an arrow. Fruit flies like a banana. match-string returns the matched string. string-match matches a string. I just miss a function to string the matches, and another one to return the stringed match... -- __Pascal_Bourguignon__ http://www.informatimago.com/