my $text = '\section{Funding\qr{The Funding statement in the Acknowledgment has been moved to Funding section. Please check and confirm if the edit is fine and amend if necessary.}}'; $text =~ s/(\\qr\{.*?\})\}/}\n\n$1/g; print "$text\n"; #### \section{Funding} \qr{The Funding statement in the Acknowledgment has been moved to Funding section. Please check and confirm if the edit is fine and amend if necessary.}