On Tue, Mar 24, 2026 at 09:12:37PM +0400, Artyom Bologov wrote:
> Hi y’all,
> 
> While processing HTML for my website, I found this peculiarity:
> sometimes the HTML tag pattern is not captured as last used pattern and
> cannot be reused in s//.../ idiom. Test file:
> 
> ------------------------------------------------------------
> <div class=note>
> Note this
> </div>
> 
> <div class=note>
> And that!
> </div>
> ------------------------------------------------------------
> 
> Test script:
> 
> ------------------------------------------------------------
> H
> g/<div class=note.*/s//{/\
> /<\/div.*/s//}/
> ,p
> Q
> ------------------------------------------------------------
> 
> Expected result: text in curly braces. Actual result:
> 
> ------------------------------------------------------------
> $ ed -s test.txt < test.ed
> {
> Note this
> }
> 
> <div class=note>
> And that!
> }
> ------------------------------------------------------------
> 
> Any ideas? Am I doing something wrong?

To see what happens try your test script on this text:
<div class=note> </div>
Note this
</div>

<div class=note> </div>
And that!
</div>

Reply via email to