email = "user@example.com" regex = /(\w+)@(\w+)\.(\w+)/ match_data = regex.match(email) puts match_data[1] # خروجی: user puts match_data[2] # خروجی: example puts match_data[3] # خروجی: com