Rather than extract the bits you want you could replace the bits you don't want with empty strings.
In Ruby,
"This is just\na simple sentence".gsub(/^This is|sentence\z/, '') #=> " just\na simple "
Rather than extract the bits you want you could replace the bits you don't want with empty strings.
In Ruby,
"This is just\na simple sentence".gsub(/^This is|sentence\z/, '') #=> " just\na simple "