Quantcast
Viewing latest article 18
Browse Latest Browse All 19

Answer by Cary Swoveland for Regex Match all characters between two strings

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 "

Viewing latest article 18
Browse Latest Browse All 19

Trending Articles