Given an email address, the result of a transformation applied to that email address, and a second email address, return the output of the same transformation applied to the second email address.
The email addresses will all have the following structure:
A string of positive length containing alphanumeric characters and at most one .
(the local part), followed by an @
symbol, followed by a string of positive length containing alphanumeric sumbols (the domain), followed by a .
symbol, and a final string of positive length containing alphanumeric characters (the TLD).
There are four allowed transformations:
- Identity (no change). (
a.b@c.d -> a.b@c.d
) - Returning just the local part (everything before the
@
) unmodified (a.b@c.d -> a.b
). - Returning the local part split on the
.
if present, with the first symbol of each half capitalised. (a.b@c.d -> A B
). - Returning just the domain (everything between the
@
and the final.
) unmodified. (a.b@c.d -> c
).
When more than one transformation is possible, you can give the output of any of the possibilities. Whitespace at the start and end of output don't matter, but in the middle does (i.e. if you split a.b
to A B
there should be just one space in the middle [and any number at the start and end of output], but if you split a.
, then A
with any number of spaces on either side are all acceptable).
Examples (input | output
):
john.doe@gmail.com, John Doe, phillip.maini@gmail.com | Phillip Maini
John.Doe@gmail.com, John Doe, Phillip.Maini@gmail.com | Phillip Maini
foo.bar@hotmail.com, foo.bar, gee.whizz@outlook.com | gee.whizz
foo.bar@hotmail.com, foo.bar, gEe.Whizz@outlook.com | gEe.Whizz
rodney.dangerfield@comedy.net, comedy, michael.scott@office.0 | office
.jones@x.1, Jones, a.@3.z | A
.jones@x.1, .jones@x.1, a.@3.z | a.@3.z
.jones@x.1, .jones, a.@3.z | a.
.jones@x.1, x, a.@3.z | 3
.@b.c, .@b.c, 1@2.3 | 1@2.3
john.jones@f.f, John Jones, 1in.thehand@2inthe.bush | 1in Thehand
chicken.soup@q.z, Chicken Soup, fab@ulou.s | Fab
lange@haare.0, lange, fat.so@fat.net | fat.so
Lange@haare.0, Lange, fat.so@fat.net | {fat.so, Fat So} # either acceptable
chicken@chicken.chicken, chicken, horse@pig.farm | {horse, pig} # either acceptable
Usual rules and loopholes apply.
@
and final.
). Since the local part and domain are bothchicken
, it's ambiguous whether it's the 2nd or 4th transformation \$\endgroup\$ – LangeHaare Oct 30 '17 at 16:28A
[with a trailing space] that the second input beJones
[with a leading space])? \$\endgroup\$ – Jonathan Allan Oct 30 '17 at 21:08.jones@x.1, Jones, a.@3.z
isA
- ifjones
is matched that means the matching part is the part between the first period and the @ symbol. But that would result in an empty string because thea
is before the first period and not after. \$\endgroup\$ – Jerry Jeremiah Oct 31 '17 at 0:17