emacs-devel
[Top][All Lists]
Advanced

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

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


From: Mattias Engdegård
Subject: Re: More re odditie [Was: regular expressions that match nothing]
Date: Thu, 16 May 2019 11:29:24 +0200

16 maj 2019 kl. 08.57 skrev phs <address@hidden>:
> 
> 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.

Actually this one is documented:

  For historical compatibility, special characters are treated as ordinary
  ones if they are in contexts where their special meanings make no sense.
  For example, `*foo' treats `*' as ordinary since there is no preceding
  expression on which the `*' can act.

and in any case the 'correct' behaviour would be to signal a syntax error, not 
repeat the empty string.

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

Thanks for reporting it, and you are right, that's a (known) bug in rx.




reply via email to

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