With a basic RE like
/<initial conditions>.*?<final conditions>/gsi
you can create Head-Tail or Left-Right wrappers.
More info on regexps? Search them!