#!/usr/local/bin/perl #use strict; use warnings; use 5.016; # 1071296 while () { # This section works OK. say "Positive lookaround first: "; if (/(?<=TAG1)(.*)(?=TAG2).*?/x) { print $1, "\n"; } if (/^(?## Positive lookaround first: text one Negative lookaround: TAG1 text one Positive lookaround first: text two Negative lookaround: TAG1 text two Positive lookaround first: text three Negative lookaround: TAG1 text three Positive lookaround first: Negative lookaround: TAGS text four Positive lookaround first: