#shortened for clarity, but works with the full thing $_ = '<*ra0*p(9,-9,0,9,0,0,g,"U.S. English")>ATTN: Out of school youth'; s/()([^ ]*)/$1$2<\$>/; print; #### <*ra0*p(9,-9,0,9,0,0,g,"U.S. English")>ATTN:<$> Out of school youth