$s = '

something something

blah blah blah

something something

'; $before = '

([^<]+)

'; $after = '

$1

'; $s =~ s/$before/$after/; print $s;