perl -E 'local $_ = "foo\n"; say "Start" if /\G foo/gcx; say "Mid" if /\G .*/gcx; say "End" if /\G (?=\n)/gcx'