LaTeX Name and Address Fields and Filter Output. Formatting and special-character codes have been stripped and the entries correctly parsed into subfields. The province, postal code, and country name have been standardized. Name and address entries on the form need to be split into subfields for the database. Names are split into an array based on punctuation and whitespace, and then compared to lists of titles to be thrown away, or likely surname components that need to be recombined into a last-name field.
Address parsing is more difficult, due to widely varying punctuation and foreign addresses.
For this reason, lists of cities and countries from past proposals are first searched, and once a city is found, the parsing is almost always right. When new cities show up, the script makes an attempt at parsing based on punctuation, flags the data, and logs the new city for possible addition to the search list. See Figure 1. The primary problem in these cases is in recognizing the many ways in which the same item can be requested. This is achieved by stepping through associative arrays in which a standardized code is the key and a regular expression that matches various forms of that item is the value.