in reply to need help with explaining the output
The commented out regex grabs everything up to a space greedily... that is, it matches everything up to the last literal space before end of string (so it grabs up to " Vinny"), and $1 is populated with anything not a literal space up to a literal space (or end of string). Put a space in "Vinny" to see for yourself.
The first regex simply captures everything greedily all the way up to the very last non-whitespace character before end of string into $1, and puts the rest in $2. The 'rest' in this case is the last letter in the first name.
-stevieb
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: need help with explaining the output
by perlynewby (Scribe) on Jul 16, 2015 at 00:33 UTC |