String validation isn't the only useful thing you can do with regular expressions. String extraction is also useful; being able to take just part of a string and manipulate it allows you to have more control over the final result. In Script 8.4, we'll take a list of names entered in first-name-first order and swap them so that they're in last-name-first order.
Script 8.4. This script rearranges an entered list of names.
To extract strings: