I am working through a book and it gives this example
x = "This is a test".match(/(\w+) (\w+)/)
We are looking at the parentheses and being able to access what is passed separately.
When I put the expression above into my IRB I get:
MatchData "This is" 1:"This" 2:"is">
Why doesn't this also include a
and Test
?
Would I have to include .match(/(\w+) (\w+) (\w+) (\w+)/)
?