Say I have a string: Hey what\'s up @dude, @how\'s it going?
I\'d like to remove all the characters before@how\'s
.
>> "Hey what's up @dude, @how's it going?".partition("@how's")[-2..-1].join
=> "@how's it going?"
Case insensitive
>> "Hey what's up @dude, @HoW's it going?".partition(/@how's/i)[-2..-1].join
=> "@HoW's it going?"
Or using scan()
>> "Hey what's up @dude, @HoW's it going?".scan(/@how's.*/i)[0]
=> "@HoW's it going?"