Here's a quote from It's Always Sunny in Philadelphia.
quote = (
"That's TA, TR's ex-girlfriend - this is classic TA. TR broke up with TA because MK said that "
"she saw TA flirting with WT at a party OK, but she was only doing it to make TR jealous because, you know, "
"she thought that TR secretly liked EH, but TR didn't like EH. It was all a bunch of bull."
)
This quote has numerous abbreviated names consisting of two capital letters. For example, "TR" stands for "Trey".
Given the following dictionary of abbreviation: full name
mappings,
abbrevs = {
"TA": "Tammy",
"TR": "Trey",
"MK": "Maureen Kinallen",
"WT": "Walt Timby",
"EH": "Erin Hannabry"
}
replace each abbreviation with the person's full name. Assume that some capitalized two-letter words like "OK", which are not abbreviated names, exist!
Expected result
newquote = (
"That's Tammy, Trey's ex-girlfriend - this is classic Tammy. "
"Trey broke up with Tammy because Maureen Kinallen said that she "
"saw Tammy flirting with Walt Timby at a party OK, but she was only "
"doing it to make Trey jealous because, you know, she thought that "
"Trey secretly liked Erin Hannabry, but Trey didn't like Erin "
"Hannabry. It was all a bunch of bull."
)
Regex Functions
Regex Patterns