From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Jesper Harder Newsgroups: gmane.emacs.help Subject: Re: match string to regexp Date: Thu, 20 Nov 2003 20:04:08 +0100 Organization: http://purl.org/harder/ Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1069356062 8316 80.91.224.253 (20 Nov 2003 19:21:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 20 Nov 2003 19:21:02 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 20 20:21:00 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 1AMuMO-00089w-00 for ; Thu, 20 Nov 2003 20:21:00 +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 1AMvEL-0008MF-97 for geh-help-gnu-emacs@m.gmane.org; Thu, 20 Nov 2003 15:16:45 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!not-for-mail Original-Newsgroups: gnu.emacs.help X-Face: ^RrvqCr7c,P$zTR:QED"@h9+BTm-"fjZJJ-3=OU7.)i/K]<.J88}s>'Z_$r; 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:14438 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:14438 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. `----