s/(<[^>]+>\s*)([\*\+\s&\w()\/\\,.?!\-:;]*)/$1.substr$dec,0,length$2,""/eig; is all it is $dec is the declaration of independence $_ is a regular html page you do that and print $_ and you have your new page with the dec of indy inside