I've been using a script to make names like "john.doe" become formatted to "John.Doe" so that it can be validated properly with a case sensitive server. I ran into a problem though, a person with the name of "Ronald.McDonald." My script can only make it "Ronald.Mcdonald." Can someone help me make it so that if the first two characts of the last name are "mc" it will capitalize the first letter and the third letter in the last name.
Here is the script I've been using:
$email = "ronald.mcdonald";
#Make email all lowercase
$email = lc($email);
#Make email in to correct format ie John.Doe
$email =~ tr/A-Z/a-z/;
$email =~ s/\b(.)/\u$1/g;
My main problem is how can I make it so that the script will only detect "mc" in the first two characters of the last name not the entire last name?
Thank,
Max Geek
Here is the script I've been using:
$email = "ronald.mcdonald";
#Make email all lowercase
$email = lc($email);
#Make email in to correct format ie John.Doe
$email =~ tr/A-Z/a-z/;
$email =~ s/\b(.)/\u$1/g;
My main problem is how can I make it so that the script will only detect "mc" in the first two characters of the last name not the entire last name?
Thank,
Max Geek