s/\&#(\d+);/chr($1)/ge; # decimal char. entity s/\&#x([\da-f]+);/chr(hex($1))/ige; # hex char. entity