Handling proper casing for last names is more nuanced than the typical case transformation because it doesn't handle specific cases like "McDonalds," "O'Brien," and "Baron-Cohen".


In order to work around this limitation, add additional conditions to the transformation rules as shown below.


If last name starts with "Mc" then replace "Mc" with "Mc " (with the space at the end), then execute case transformation and replace back "Mc " to "Mc".



Same approach for last names starting with O' is displayed below, first replace "o'" with "O' " (with space at the end), then replace back.


For the last names containing hyphen use the following rule. Replace "-" with "- " (with space at the end), transform to proper case, replace "- " back to "-".