#!/usr/bin/perl
use warnings;
use strict;
print "Zero-width negative look-ahead assertion\n\n";
quote_ampersands("foo bar & baz"); # Replace this one
quote_ampersands("10 < 20" ); # Don't replace this one
quote_ampersands("et&" ); # Don't replace this one
quote_ampersands("4 > 2" ); # Don't replace this one
quote_ampersands("abc>ef" ); # Replace this one
sub quote_ampersands {
my $text = shift;
printf " %-20s", $text;
$text =~ s/&(?!amp;|lt;|gt;)/&/g;
printf "%-20s\n", $text;
}