Regex for reverse match a string

Try:

> 'gmail.test.com'.split('.').last(2) == ['test','com']
=> true 

Leave a Comment