unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tim Landscheidt <tim@tim-landscheidt.de>
To: help-gnu-emacs@gnu.org
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	[thread overview]
Message-ID: <m3wry4qght.fsf@passepartout.tim-landscheidt.de> (raw)
In-Reply-To: mailman.1559.1266700478.14305.help-gnu-emacs@gnu.org

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


  parent reply	other threads:[~2010-02-23 12:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-18  6:10 Perl, etc has these "?"-prefix modifiers/codes/whatever. Precisely which does emacs have (and NOT have)? David Combs
2010-02-18 11:46 ` Pascal J. Bourguignon
2010-02-18 16:57   ` John Withers
     [not found]   ` <mailman.1450.1266512270.14305.help-gnu-emacs@gnu.org>
2010-02-18 19:02     ` Pascal J. Bourguignon
2010-02-18 21:38       ` John Bokma
2010-02-18 21:42       ` John Withers
     [not found]       ` <mailman.1460.1266529372.14305.help-gnu-emacs@gnu.org>
2010-02-19  0:53         ` David Combs
2010-02-19  1:06         ` Pascal J. Bourguignon
2010-02-19  2:36           ` John Withers
     [not found]           ` <mailman.1470.1266547034.14305.help-gnu-emacs@gnu.org>
2010-02-19  6:48             ` Tim X
2010-02-20 21:14               ` John Withers
     [not found]               ` <mailman.1559.1266700478.14305.help-gnu-emacs@gnu.org>
2010-02-23 12:33                 ` Tim Landscheidt [this message]
2010-02-18 16:23 ` Tyler Smith
     [not found] ` <mailman.1449.1266510261.14305.help-gnu-emacs@gnu.org>
2010-02-19  0:59   ` David Combs
2010-02-19  3:22     ` Tyler Smith
2010-02-24 19:54 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3wry4qght.fsf@passepartout.tim-landscheidt.de \
    --to=tim@tim-landscheidt.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).