emacs-devel
[Top][All Lists]
Advanced

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

More re odditie [Was: regular expressions that match nothing]


From: phs
Subject: More re odditie [Was: regular expressions that match nothing]
Date: Thu, 16 May 2019 08:57:18 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

While testing how rx handles the new regexp-unmatchable construct, I
stumbled on some odd emacs behavior.

The regular expression "*", instead of matching zero-or-more occurrences
of the empty string, behaves as "\*" or "[*]" and only matches the *
character.

I believe this is a bug, not a feature, and in any case the Emacs manual
does not document this behavior.
Perhaps it is not a bug in Emacs per se, rather a bug in the gnulib
regex library so I'll wait for comments before submitting a bug report...

If this behavior is the expected one, then (rx (0+ "")) should not
return "*".

We have the same problem with "+" and (rx (1+ "")).

-phs

On 2019/05/15 23:07, Mattias Engdegård wrote:
> 15 maj 2019 kl. 22.17 skrev Michael Heerdegen <address@hidden>:
>> Should there be an rx regexp form for this?
> We don't necessarily need a special form for it; we can just make `(or)' work.
>
> Proposed patch attached. (I also added its dual, (seq), since it would be 
> silly not to.)
>




reply via email to

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