unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Shy groups and * ...eh, what?
@ 2022-10-22  4:24 Michael Heerdegen
  2022-10-22  6:11 ` Heime
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Michael Heerdegen @ 2022-10-22  4:24 UTC (permalink / raw)
  To: Emacs mailing list

Hello,

I wanted to be sure I correctly understood that if you give multiple RX
arguments to the `rx' `*' operator, they are implicitly interpreted as a
sequence (AFAIU, that's the case.  An implicit `or' would also make
sense, that's why I wondered).

Anyway, here is what I tried:

(string-match-p
 (rx bos (* "a" "b") eos)
 "a")
==> 0

(string-match-p
 (rx bos (* "a" "b") eos)
 "b")
==> nil

Eh - what?  With evaluated `rx' forms this is

(string-match-p
 "\\`\\(?:ab\\)*\\'"
 "a")
==> 0

(string-match-p
 "\\`\\(?:ab\\)*\\'"
 "b")
==> nil

Makes no sense to me.  When I change the wrapping shy groups to normal
groups the result makes more sense to me:

(string-match-p
 "\\`\\(ab\\)*\\'"
 "a")
==> nil

(string-match-p
 "\\`\\(ab\\)*\\'"
 "b")
==> nil

Do I miss something or is it just a bug?


TIA,

Michael.



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-10-25  4:43 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-22  4:24 Shy groups and * ...eh, what? Michael Heerdegen
2022-10-22  6:11 ` Heime
2022-10-22  6:39 ` tomas
2022-10-23  2:47   ` Michael Heerdegen
2022-10-24  4:45     ` tomas
2022-10-24 21:01       ` Emanuel Berg
2022-10-25  3:12       ` Michael Heerdegen
2022-10-25  3:44         ` Emanuel Berg
2022-10-25  4:43         ` tomas
2022-10-22  6:49 ` Heime
2022-10-22  7:37 ` Michael Heerdegen
2022-10-22  8:34   ` tomas
2022-10-22  8:41     ` Michael Heerdegen
2022-10-22 11:12   ` Bruno Barbier
2022-10-23  2:45     ` Michael Heerdegen
2022-10-24  4:27       ` Emanuel Berg
2022-10-22 19:54 ` [External] : " Drew Adams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).