if you surround a section with (), the data matched is made available separately from the rest.
x = "This is a test".match(/(\w+) (\w+)/) puts x[0] puts x[1] puts x[2]