Given a list of names, I want to squash names like "Dos Santos", "Van der Ploeg" or "Abdel-Hamid" to "DosSantos", "VanderPloeg" and "AbdelHamid", respectively.
However, plain removal of " " or "-" will not do, for I need to preserve double names such as "Baker-Wilson" or "Ann-Catherine".
A simple regex substitution would do if I had just single prefixes, but that does not work for double prefixes like "De la", "Van der" or "Bin Abdul" which contain spaces themselves.
Using Python 3: What would be a good (=efficient) way to do this transformation using standard libraries? For each name loop over all known prefixes and just substitute what I find, or is there a more clever way?