Extract labelled groups of sub-strings from a string.