[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Regex matching summary blocks in C#
From: |
tomas |
Subject: |
Re: Regex matching summary blocks in C# |
Date: |
Sun, 3 Dec 2023 16:15:30 +0100 |
On Sun, Dec 03, 2023 at 08:26:51PM +0530, Samvid Mistry wrote:
>
> Yuri Khan <yuri.v.khan@gmail.com> writes:
>
> > On Sun, 3 Dec 2023 at 21:23, Samvid Mistry <mistrysamvid@gmail.com> wrote:
> >
> >> > \\(\\(?:.*\n\\)*?\\)
> >>
> >> IIUC, you are suggesting I do this
> >>
> >> "\\(\\s-*\\)///\\s-*<summary>\\s-*\n\\(\\(:?.*\n\\)*?\\)\\s-*///\\s-*</summary>"
> >
> > \\(?:, not \\(:? . The former marks the group as non-capturing. The
> > latter introduces a capturing group starting with a colon.
>
> That was my bad. Your expression seems to have worked. Thanks!
>
> Would you mind expaining a bit about why it works? Per my current
> understanding, both mine and yours should have the same net effect,
> except that marking the inner group non-capturing should make the regex
> evaluation a bit faster because emacs need not remember the matched
> text. But clearly, my understanding isn't correct.
Not Yuri here, but I think your expression does match several times,
and it keeps the last match. Yuri's captures the whole bunch just
once.
Cheers
--
t
signature.asc
Description: PGP signature