[Top][All Lists]

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

Re: Ugly regexps

From: Stefan Kangas
Subject: Re: Ugly regexps
Date: Thu, 4 Mar 2021 12:35:58 -0600

Alan Mackenzie <acm@muc.de> writes:

>> I was going to ask why not just do PCRE, but then I realized I'm not
>> exactly sure what the syntactical differences are.  (We obviously lack
>> some features.)  AFAIR, Emacs regexps don't exactly match GNU grep,
>> egrep, Perl, or anything else really.
> These things don't exactly match eachother, do they?

There is also a POSIX standard for BRE and ERE that we don't follow.

My point is that we could match one of the above, even if they don't
match each other.

> The "biting" effect is surely small.  I have little difficulty using
> grep, egrep and awk, all of whose regexp notations differ somewhat.

I am happy to hear that this works well for you.  Two decades after
writing my first regexp, I still tend to forget sometimes (oh wait is it
\+ in sed again?).  Then I have to look these stupid details up for the
Nth time.

> There's not a lot wrong with Emacs's regexp notation.  It works, works
> well, and we're all familiar with it.

Of course it gets the job done in the sense that you can write a regexp
that will match what you want.

But it is overly verbose in common cases, making regexps harder than
they need to be to read, understand and modify.

reply via email to

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