help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Perl, etc has these "?"-prefix modifiers/codes/whatever. Precisely w


From: John Withers
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

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 <grayarea@reddagger.org> 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. 
<snip>
> 
> 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
> 
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]