Here's an example based on the pre-5.10 (?>pattern) atomic grouping. It should be fairly easily convertable to use the + possessive quantifier modifier. (I'm using 'x' in place of '"' because Windose command line and my REPL don't like double-quotes, but you get the idea.)
c:\@Work\Perl\monks>perl -wMstrict -le
"print 'perl version: ', $];
print '------------';
;;
my $non_x_or_escaped = qr{
(?> [^x\\]{0,32766}) (?> (?> \\.){0,32766} (?> [^x\\]{0,32766}))
}xms;
;;
my $s = 'zx' . ('\x' x 1_000_000) . 'xz';
print 'length of test string: ', length $s;
print substr($s, 0, 20), ' ... ', substr($s, -20);
;;
print 'MATCHED' if $s =~ m{ (x (?> $non_x_or_escaped)* x) }xms;
my $captured = $1;
print 'length captured: ', length $captured;
print substr($captured, 0, 20), ' ... ', substr($captured, -20);
print '------------';
;;
$s = 'zx' . ('p' x 1_000_000) . '\x' . ('q' x 1_000_000) . 'xz';
print 'length of test string: ', length $s;
print substr($s, 0, 20), ' ... ', substr($s, -20);
;;
print 'MATCHED' if $s =~ m{ (x (?> $non_x_or_escaped)* x) }xms;
$captured = $1;
print 'length captured: ', length $captured;
print substr($captured, 0, 20), ' ... ', substr($captured, -20);
"
perl version: 5.008009
------------
length of test string: 2000004
zx\x\x\x\x\x\x\x\x\x ... \x\x\x\x\x\x\x\x\xxz
MATCHED
length captured: 2000002
x\x\x\x\x\x\x\x\x\x\ ... x\x\x\x\x\x\x\x\x\xx
------------
length of test string: 2000006
zxpppppppppppppppppp ... qqqqqqqqqqqqqqqqqqxz
MATCHED
length captured: 2000004
xppppppppppppppppppp ... qqqqqqqqqqqqqqqqqqqx
Give a man a fish: <%-{-{-{-<