Hello everyone,
I have a list of lists such as
theLists = {
{"Joe", "123 Oak Street", "Pine City", "MA", 10456,
"More info on Joe", "Still more info on Joe"},
{"Mary", "654 Hill Avenue", "Grove City", "FL", 60834,
"More info on Mary", "Still more info on Mary",
"And even more info on Mary"}
}
In this case, there is a name, street address, city, state, zip code, and then any number of items of additional information. What I want to do is strip away the addresses (everything up to and including the zip codes) and keep the trailing information. The number of items making up an address also vary.
The following works by checking for a state followed by an integer that represents a zip code. But as you can see, I had to manually specify a (partial) list of states to check.
theLists /. {___, "CA" | "MA" | "FL" | "MD", _Integer, x__} -> {x}
Is there some way to use MemberQ to check a predefined list of all states?
Gregory