in reply to How to make substitute greedy like sed's substitute

Try this substitute command;

$scalarWorkingConfig =~ s/.*XXXXX\s(<$domainProperty +.*$domainPropert +y>).*/$1/g;