note
Eily
<p>Not a single regex but one way to do what you want is to read your file in paragraph mode, with [doc://perlvar|$/] and split the logic:
<c>{
local $/ = ""; # Edit: added use of local for good practice
while (<DATA>)
{
s/^##.*//s unless /^\w/m;
print;
}
}
__DATA__
## Remove
## Keep
this
## Remove
## Also keep
that</c></p>
<p>Otherwise you could use a negative [https://www.regular-expressions.info/lookaround.html|look ahead assertion] <c>(?!^\w)</c></p>
<p>Edit: seems like I really didn't read the requirement well enough ^^"</p>
11119658
11119658