$_ = "fox comes and fox goes into forest"; s/(.*)(fox.+?forest)/$1the $2/; print;