From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rasmus Newsgroups: gmane.emacs.help Subject: Re: Question about string-match and match-string Date: Wed, 17 Jul 2013 10:44:45 +0200 Message-ID: <87sizdbmo2.fsf@gmx.us> References: <20130717081704.GB16899@kuru.dyndns-at-home.com> <20130717083511.GC16899@kuru.dyndns-at-home.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1374050727 27553 80.91.229.3 (17 Jul 2013 08:45:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Jul 2013 08:45:27 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 17 10:45:28 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UzNMS-0000o4-2R for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Jul 2013 10:45:24 +0200 Original-Received: from localhost ([::1]:49169 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzNMR-00073J-Kq for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Jul 2013 04:45:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42140) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzNMB-0006z1-RJ for help-gnu-emacs@gnu.org; Wed, 17 Jul 2013 04:45:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UzNM7-0004JN-3U for help-gnu-emacs@gnu.org; Wed, 17 Jul 2013 04:45:07 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:43327) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzNM6-0004GT-Sr for help-gnu-emacs@gnu.org; Wed, 17 Jul 2013 04:45:03 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UzNM4-0000Z5-Sp for help-gnu-emacs@gnu.org; Wed, 17 Jul 2013 10:45:00 +0200 Original-Received: from business-213-023-238-209.static.arcor-ip.net ([213.23.238.209]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 17 Jul 2013 10:45:00 +0200 Original-Received: from rasmus by business-213-023-238-209.static.arcor-ip.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 17 Jul 2013 10:45:00 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 37 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: business-213-023-238-209.static.arcor-ip.net In-Reply-To: <20130717083511.GC16899@kuru.dyndns-at-home.com> (Suvayu Ali's message of "Wed, 17 Jul 2013 10:35:11 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAHlBMVEUKFRJUbVlfi3YgQT2n 0Kvg/N5UophZjX8kV1c+lpjySPhsAAAACXBIWXMAAABIAAAASABGyWs+AAAB8ElEQVQ4y9VTwY7T QAydrDn02KiL6HGpirhOsJDCbQvJnV0yd5C6WfXIgWY50h5wj0ioyvwtz56kSKU/gKWm4/dsP4+d OJcsX8zcJbuuQ3N7Ac+qEELjLyQEtdt/amaVZoQGxzf4//CXgIQSU5fVoarDqWa2hMBVCDeoeeOy cDcS+bKaOvc23GXhHu7zZiSK5Urzwv2z8BGHK6QNxML06qZOUBivVFyb/4AGpkaMfRW5+d9CnYh6 JLJEvEKnn9VtVgNBmRHr9UP4pOInwuU5HpN4bNtKB1TlY0aR47ISY9z8XumApgPumNmxxAOoummq RSK8Z+eZWHrgcV1V73MbFrH35JlLLRVju26/mARAoAlHqePm2L5MG2HgxCwHI2IfN33COcUroSbv NlKwV4KoBA6il74X5gMcnyqh0Mk0ez4DQcTWEmyvP+iV/dx73MAnDWBS7nH2/FMgohpDAiuc8r1e kU38IHuSJKgPI7T2D/RDqXUjCPgEeNdGsTg/kKzDkvm2fezF69C0y0SQ80W3ffwVD1KqJKVSrBfZ da93Ty++d0+mmGbK9pLIbJdLuYW+rUGTSjsJz2WWdd1XqGMQRNiPI0+8Rwx5vXZaqbWLALg8rMZW qo2hJ6cEpdDh5RiAyfm3h1iDsnOCxsxz3P2H9gdT4qxCIzJxIQAAACV0RVh0ZGF0ZTpjcmVhdGUA MjAxMS0wNy0yMVQxNzoyNDo1NSswMjowMFwRps8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTEtMDct MjFUMTc6MjQ6NTUrMDI6MDAtTB5zAAAAAElFTkSuQmCC Cancel-Lock: sha1:2GU4D69T3SYKx6qsZMgh7a2EZvU= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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 Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:92197 Archived-At: Suvayu Ali writes: > On Wed, Jul 17, 2013 at 10:17:04AM +0200, Suvayu Ali wrote: >> >> Debugger entered--Lisp error: (args-out-of-range -1 -1) >> replace-match("" t nil "{" 1) > > I forgot to mention, the string above, "{", keeps changing with every > subsequent evaluation! I tried to extract the sub-expressions with > match-string with no luck. I get nil! > > (let ((test "\\section{Heading{ignoreheading}}\nText\n")) > (string-match "\\(\\\\\\\\section{.+{ignoreheading}}\\\\n\\)\\(.+\\)" test) > (match-string 1 test) > ) Are you just trying to implement an ignoreheading filter? This is what I use. I think Nicolas provided it in a post at some point but I'm not sure. (defun rasmus/org-latex-ignore-heading (headline backend info) "Strip headline from HEADLINE if it has tag ignoreheading for certain headlines. `info' is Ignored" (when (and (org-export-derived-backend-p backend 'latex 'html 'ascii) (string-match "\\`.*ignoreheading.*\n" (downcase headline))) (replace-match "" nil nil headline))) (add-to-list 'org-export-filter-headline-functions 'rasmus/org-latex-ignore-heading) –Rasmus -- Hvor meget poesi tror De kommer ud af et glas isvand?