perl -pi -e 's/(\S+)<\?Pub \_hardspace\?\>(\S+)/$1 $2<\/xx\>/gs' test