s = "abcdef"w = "ef"t = s.sub(/#{w}\z/, "") puts t
Standard input is empty
abcd
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!