From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim Landscheidt Newsgroups: gmane.emacs.help Subject: Re: Perl, etc has these "?"-prefix modifiers/codes/whatever. Precisely which does emacs have (and NOT have)? Date: Tue, 23 Feb 2010 12:33:02 +0000 Organization: Message-ID: References: <877hqaojg9.fsf@galatea.lan.informatimago.com> <873a0ynz99.fsf@galatea.lan.informatimago.com> <87r5oi11bb.fsf@galatea.lan.informatimago.com> <87d40167r2.fsf@lion.rapttech.com.au> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1266928860 13349 80.91.229.12 (23 Feb 2010 12:41:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 23 Feb 2010 12:41:00 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 23 13:40:56 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 1Nju4J-0003lU-6H for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Feb 2010 13:40:51 +0100 Original-Received: from localhost ([127.0.0.1]:42713 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nju4I-0004BE-DA for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Feb 2010 07:40:50 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 39 Original-X-Trace: individual.net 9Y9tPe+D8PFrkl98hUyWhAy51Fgy9hW+FTSYrjBOuxHpAsvBBY Cancel-Lock: sha1:QlHFukdkv7tPWbkQfOzJ9xzEp3k= sha1:65W8ZNQrBLCJBBv4e69+I4oKYes= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Original-Xref: news.stanford.edu gnu.emacs.help:177028 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:72066 Archived-At: John Withers wrote: > You are completely correct on all counts. What I should have said was > that for many classes of problems I run into during my daily work the > ability to write a regex is much faster than using a parser (and > definitely than writing one). And that I find the classes of problems > that fit that mold increased by having lookahead/behind assertions. > I use parsers more frequently than I use regexes, but a lot of the one > shot work I do on logs, semi-structured text files of various types and > in very, very limited cases some html where the html is already > processed in some way; a quick regex is much faster for me, and I > imagine almost everyone, but I could be wrong. > [...] Same with me; and I would add that the maintainability in- creases drastically as well. If I have to revisit a term like: | (while (re-search-forward "foo" nil t) | (save-match-data | (when (not (looking-at "bar")) | (replace-match "XYZ"))))) or even: | foo\($\|[^b]\|b[^a]\|ba[^r]\) I need much more time to understand what I tried to achieve than with: | foo(?!bar) Furthermore, if the handmade parser has a subtle deviation from what you would expect it to look like, you spend even more time figuring out whether that was a wanted effect or a bug not yet discovered. Tim