See [String#rpartition](http://www.ruby-doc.org/core-2.2.0/String.html#method-i-rpartition) in ruby.