Trying to come up with notepad++ flavored regex to match beginning
including middle
but without another beginning
in-between.
beginning //line 1
something something
middle //line 5 (first correct match lines 1 to 5)
beginning //line 7
something something
beginning //line 11
something something
middle //line 15 (second match lines 7 to 15 - incorrect because there is another 'beginning' in-between
My best current attempt is beginning.*?(?!beginning)middle
(with multiline and . matching newlines) captures patterns as shown in comments.
Hot to fix it so that the second pattern only includes lines 11 to 15?