ruby - Regex for reverse match a string -
i want reverse match string using regex
ex: "test.com".match(/gmail.test.com/)(we can "gmail.test.com".match(/test.com/) have situation requires check inverse match).
is possible?. can me please.
thanks in advance!!
try:
> 'gmail.test.com'.split('.').last(2) == ['test','com'] => true
Comments
Post a Comment