Hello, @mark-boonie and All,
I said in this post that we can translate the regex’s logic to :
What_I_do_not_want(*SKIP)(*F)|What_I_want. See also the excellent article, on this topic, at https://www.rexegg.com/backtracking-control-verbs.php#skipfail !
But, regarding your present example, @mark-boonie, I suppose that we should invert the logic and tell :
What_I_want_to_keep(*SKIP)(*F)|What_I_want_to_delete
This means that any multi-lines block, with delimiters Block start and Block end containing the string 80 00010000 is not considered ( text is skipped ) and that any single line contents, with its line-break, due to the (?-s) modifier, must be deleted
Note that the use of the Backtracking Control Verbs (*SKIP) and (*F) is not mandatory at all ! we could have used this syntax, instead, for similar results :
SEARCH (?s)^\*Block start\h*((?!\*Block start).)+?80 00010000.+?^\*Block end\h*\R?|(?-s)^.*\R?
REPLACE (?1$0)
We simply change the non-capturing group (?:(?!\*Block start).)+? into a capturing group ((?!\*Block start).)+?
We tell that, in replacement, we must rewrite any block entirely ( $0 ), if the group 1 exists, thus the (?1$0) syntax
And, as there is no colon char and text after (?1$0, nothing must be taken in account if the group 1 is absent, which is the case in the (?-s)^.*\R? part !
Best regards,
guy038