help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Shy groups and * ...eh, what?


From: Heime
Subject: Re: Shy groups and * ...eh, what?
Date: Sat, 22 Oct 2022 06:11:21 +0000

------- Original Message -------
On Saturday, October 22nd, 2022 at 4:24 AM, Michael Heerdegen 
<michael_heerdegen@web.de> wrote:


> 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).

You are correct, they should be interpreted as a sequence.
 
> 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.



reply via email to

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