[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Ugly regexps
From: |
Lars Ingebrigtsen |
Subject: |
Re: Ugly regexps |
Date: |
Wed, 03 Mar 2021 14:57:12 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> So you can do
>
> (string-match (ere "\\(def(macro|un|subst) .{1,}"))
>
> instead of
>
> (string-match "(def\\(macro\\|un\\|subst\\) .\\{1,\\}")
>
> ?
Sounds good to me. In some cases, introducing an alternative syntax can
create confusion, but I don't think that's really the case here -- I
think everybody knows this syntax, perhaps better than the Emacs regexp
syntax.
The byte compiler can do the transformation, I guess? (When it's a
string literal, which is usually is.) So there should be no performance
impact. And when Emacs finally grows support for a regexp object, then
`ere' can return one of those.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- Re: Ugly regexps, (continued)