$text =~ s!(.*?)(.*?)!$1$3!gi; #### $text =~ s!(.*?)!$3!gi;