fork(1) download
  1. #!/usr/bin/perl -p0777
  2. $s = "wrapping-start"; $e = "wrapping-end";
  3. s/(anchor-start\s*)(?!$s)(.*?)(\s*anchor-end)(?<!$e)/$1$s\n$2\n$e$3/g
Success #stdin #stdout 0s 4596KB
stdin
This
is
a
test. 1
anchor-start
text to wrap will is in here
anchor-end

This
is
a
test. 2
anchor-start
wrapping-start
text to wrap will is in here
wrapping-end
anchor-end

This
is
a
test. 3
anchor-start
text to wrap will is in here
anchor-end
stdout
This
is
a
test. 1
anchor-start
wrapping-start
text to wrap will is in here
wrapping-end
anchor-end

This
is
a
test. 2
anchor-start
wrapping-start
text to wrap will is in here
wrapping-end
anchor-end

This
is
a
test. 3
anchor-start
wrapping-start
text to wrap will is in here
wrapping-end
anchor-end