From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Withers Newsgroups: gmane.emacs.help Subject: Re: Perl, etc has these "?"-prefix modifiers/codes/whatever. Precisely which does emacs have (and NOT have)? Date: Sat, 20 Feb 2010 13:14:25 -0800 Message-ID: <1266700465.7034.128.camel@Frank-Brain> 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> Reply-To: grayarea@reddagger.org NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1266809191 9743 80.91.229.12 (22 Feb 2010 03:26:31 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 22 Feb 2010 03:26:31 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Tim X Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Feb 20 22:45:53 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 1NiwfJ-00075x-ES for geh-help-gnu-emacs@m.gmane.org; Sat, 20 Feb 2010 22:15:05 +0100 Original-Received: from localhost ([127.0.0.1]:48979 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NiwfI-0004MX-NN for geh-help-gnu-emacs@m.gmane.org; Sat, 20 Feb 2010 16:15:04 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Niwep-0004IG-GX for help-gnu-emacs@gnu.org; Sat, 20 Feb 2010 16:14:35 -0500 Original-Received: from [140.186.70.92] (port=44120 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Niweo-0004GN-D6 for help-gnu-emacs@gnu.org; Sat, 20 Feb 2010 16:14:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Niwen-0000re-9a for help-gnu-emacs@gnu.org; Sat, 20 Feb 2010 16:14:34 -0500 Original-Received: from assert.reddagger.org ([66.211.107.215]:33721 helo=mail.reddagger.org) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Niwen-0000rW-1W for help-gnu-emacs@gnu.org; Sat, 20 Feb 2010 16:14:33 -0500 Original-Received: by mail.reddagger.org (Postfix, from userid 1007) id 4FAE618A41D7; Sat, 20 Feb 2010 13:14:35 -0800 (PST) Original-Received: from [192.168.1.101] (c-67-164-33-174.hsd1.ca.comcast.net [67.164.33.174]) by mail.reddagger.org (Postfix) with ESMTP id 2F66318A4029; Sat, 20 Feb 2010 13:14:30 -0800 (PST) In-Reply-To: <87d40167r2.fsf@lion.rapttech.com.au> X-Mailer: Evolution 2.24.3 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:71989 Archived-At: Tim, 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. But in reality, as you pointed out, I shouldn't have been in the discussion at all. Next week I am going to have time to look at Tomohiro Matsuyamas patch that I referenced in the first of my posts in this string. My comments should have been restricted to just saying that I am looking forward to doing so. Thank you for pointing this out. john withers On Fri, 2010-02-19 at 17:48 +1100, Tim X wrote: > John Withers writes: > > > On Fri, 2010-02-19 at 02:06 +0100, Pascal J. Bourguignon wrote: > > > >> > >> One difficulty when you try to extend regular expression is that the > >> time and space complexity of matching such an extended regular > >> expression easily becomes exponential. In these cases, it may be easier > >> to write a parser, than to try to force it thru regular expressions, > >> both for the programmer's brain and for the CPU processor... > > > > Sure exponential backtracking can happen, you can write checks for > > common cases and aborts, but let's say you don't. Who cares? I can write > > things that go exponential for memory or clock ticks in any of the > > languages I am even trivially familiar with. > > > >> Otherwise, people will do anything they want to do, theory and > >> precendent nonobstant. This only demonstrate the lack of culture of the > >> newcomers. > > > > Or it demonstrates the need to get things done. I can write a regex to > > do a transform on 1000 text files in a directory and do the operation > > before you have closed the last paren on your parser. > > > > I'm always amazed at these sort of claims because they are just so > meaningless. for every concrete example you can come up with, we can > come up with others where writing the parser will be faster and more > reliable than using REs. > > Posts like "Plese, someone else do something that I want" rarely > achieves anything other than make readers think its just a moan from > someone who is frustrated but not frustrated enough to do anything about > their problem except moan. While its fine to be lazy, being lazy and > fussy is just a recipie to make one miserable. Being lazy, fussy and a > moaner just adds noise that makes it harder to find relevant > information. > > Tim > >