line = "My name is Inigo Montoya." for [first, last] = line =~ %r/my name is (\w+) (\w+)/ig { println["First name is: $first"] println["Last name is: $last"] }