Learning how to extract parts of a string