emacs-devel
[Top][All Lists]
Advanced

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

Re: Ugly regexps


From: Stefan Monnier
Subject: Re: Ugly regexps
Date: Wed, 03 Mar 2021 10:46:20 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> So you can do
>>
>>     (string-match (ere "\\(def(macro|un|subst) .{1,}"))
>>
>> instead of
>>
>>     (string-match "(def\\(macro\\|un\\|subst\\) .\\{1,\\}")
>
> Why not use 'rx' in those cases?

Not sure what you mean by "those cases".  I'm thinking this `ere` would
be useful for the cases where the author finds `rx` unpalatable for
some reason.

> IMO it makes the regexp even more easy to write and read.

I believe this depends on taste and circumstances.  Experience shows
that while some packages use `rx` extensively, most ELisp code doesn't.


        Stefan




reply via email to

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