Mega Code Archive
Categories
/
Ruby
/
String
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]