If the goal is simply to insert a tab before the assumed city in the sample data, that could be accomplished with a wildcard Find/Replace, where:
Find = ([A-Z]*[A-Z]*[A-Z]*[A-Z]*)([A-Z][!^13]@^13)
Replace = \1^t\2
And, if cleaning up the split words is required, that could be accomplished with just:
Find = ( )([a-z])
Replace = \2
Note that this would also fix the split words in the 2nd problem.
While the process offered works for the limited examples supplied, there are many other situations in which the same process will fail. For example:
Mr.Albert Van der Meer New York.NY
Mrs.Ann M St John Rhode Is.NY
where 'Van der Meer' or 'St John' is the surname. The process messes up both surnames, joining the 'Van der' together as one word when it should remain two words and putting the tab between 'St' and 'John' in the 'St John' surname! The process also won't work if you have only one given name or initial for the person. I'm sure I could find plenty of other situations where the result would be incorrect, too.
The process only appears to work - because the sample data are not sufficiently comprehensive. To do the job properly requires a lookup table of cities and states.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
|