Quantcast
Channel: Regex Match all characters between two strings - Stack Overflow
Viewing all articles
Browse latest Browse all 19

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

$
0
0

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 all articles
Browse latest Browse all 19

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>