- Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
- array ( 0 => 'include this line and this as single match', 1 => 'and this as single match', 2 => '', 3 => 'include this line', )
<?php
$texts[] = <<<TEXT
EXCLUDE this entire line
include this line
even this to EXCLUDE
and EXCLUDE this
and this as single match
and EXCLUDE this line
TEXT;
$texts[] = <<<TEXT
EXCLUDE this entire line
and EXCLUDE this
and this as single match
TEXT;
$texts[] = <<<TEXT
EXCLUDE this entire line
even this to EXCLUDE
and EXCLUDE this
and EXCLUDE this line
TEXT;
$texts[] = <<<TEXT
include this line
even this to EXCLUDE
TEXT;
var_export(
preg_replace('/(\R)?.*\bEXCLUDE\b.*(?(1)|\R?)/', '', $texts)
);