[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:49:19 +0000 |
Sent with Proton Mail secure email.
------- 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).
>
> 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
I usually do
(string-match-p (rx (seq bos (or "aa" "bb" "cc") (zero-or-more any) eos))
"bboeuoeu")
> 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.
- Shy groups and * ...eh, what?, Michael Heerdegen, 2022/10/22
- Re: Shy groups and * ...eh, what?, Heime, 2022/10/22
- Re: Shy groups and * ...eh, what?, tomas, 2022/10/22
- Re: Shy groups and * ...eh, what?, Michael Heerdegen, 2022/10/22
- Re: Shy groups and * ...eh, what?, tomas, 2022/10/24
- Re: Shy groups and * ...eh, what?, Michael Heerdegen, 2022/10/24
- Re: Shy groups and * ...eh, what?, tomas, 2022/10/25
- Re: Shy groups and * ...eh, what?, Emanuel Berg, 2022/10/25
- Re: Shy groups and * ...eh, what?, Emanuel Berg, 2022/10/25
Re: Shy groups and * ...eh, what?,
Heime <=
Re: Shy groups and * ...eh, what?, Michael Heerdegen, 2022/10/22
RE: [External] : Shy groups and * ...eh, what?, Drew Adams, 2022/10/22