in reply to How about Dutch Surnames?
in thread Handling caps for surnames with capitals in the middle (was: Irish Surnames)

Anyway, here's a quick hack to show the heuristic:

#!/usr/bin/perl -w use strict; for (qw(mcginley macgee develera)) { print "$_ => ".handle_caps($_)."\n"; } sub handle_caps { # this assumes irish capitalisation! my $name = ucfirst(shift); for (qw(Mc Mac)) { # always ok $name =~ s/^$_(.*)/$_\u$1/; } for (qw(De)) { # may not be followed by [aoeiu] # ?? don't know enough irish # for this rule ;-) $name =~ s/^$_([^aoeiu].*)/$_\u$1/; } return $name; }