$re = '/^([A-Z][A-Z])/m';
$str = 'EPISODE 148: The Flea Party
TAFFY
Per-fect!
BENTLEY
Gotcha!
MRS M
Aaaah! I must ask Forsythe not to leave his kitchen cabinets lying around on the floor like this!
MRS M
Oh my! I hope my little cherub doesn’t have fleas or I’ll have to take that ribbon right off and put a flea collar on you!
TAFFY
Take the ribbon off?
TAFFY
Fleas? Please! This is just a common itch, I don’t have fleas.
BENTLEY
Oh no? Well you will my friend, you will. And I know just where to find them
FLEA 1
Cookie crumb?
FLEA 2
Don’t mind if I do.
MISH
Moldy macaroon?
MASH
Thank you kindly!
MISH & MASH
One for me, one for flea.
MASH
Enjoy, little dudes!
MISH
Ouch! Hey, what was that?!
MASH
Ow! Keep yer paws off my hairdo!
MISH
Me!? You’re the one pocking my hair!
MASH
Are you kidding me?
MISH
Liar!
MASH
What did you say?
MISH
I said…
MASH
Moldy macaroon?
MISH
Don’t mind if I do.
FLEA
HEY LET US OUT!!!
BENTLEY
Yeah, yeah, be patient
FLEA 1
Oh! Love that new host smell!
You said it! Let’s settle here!
BENTLEY
Look! Fleas! Fleas!!! Whoo whoo whoo, fleas !
MRS M
Oh dear! you’re not scratching again are you?
BENTLEY
Go ahead, scratch it up! You know you want to.
MRS M
Delightful dinero, a discothèque!
MRS M
Like summer nights in Salamanca.
MRS M
Don’t be a party pooper, Bentley, dance with your little brother!
Flea
Earthquake!
Flea
Let’s move from this place!
MRS M
Coming!
TAFFY
Huh. I don’t itch anymore.
BENTLEY
Of COURSE you do! You’re covered in flea-AA!
MRS M
Bentley, now you?! And it looks like you might need more than a flea collar, you may need a HOT FLEA BATH.
MRS M
Sorry dear, what was that again?
TAFFY
Ah! That will teach you to start a flea fight
MRS M
Well if you can’t decide, why not buy BOTH yachts, dear?
MRS HIGHCOST
Hello? Are you still there?
MRS M
Oh sorry darling. Can you get them in platinum?
TAFFY
I love scratching
TAFFY
Scratch scratch scratch scratch
MRS HIGHCOST
So… Platinum or diamond then?
MRS M
Oh sorry dear, let’s have a look in the magazine
TAFFY
Here buddy, this will help!
BENTLEY
Oh! Itchy wool!
MRS M
Well of course matching helicopters! What are we? Cave people?
FORSYTHE
I’ve nearly achieved...PERFECTION!
FORSYTHE
Out of my kitchen you fleabag!
MRS M
Animal control, I have a flea emergency!
MASH
There you are! We found you!
TAFFY
Found me?
MASH
Not you-– them!
MISH & MASH
Welcome home fellas!
See ya!
ANIMAL CONTROL
This is worse than the Itchy Dingo Disaster of ‘05.
TAFFY
Showtime!
MRS M
Oh my hair!
Oh! What a wonderful haircut for this summer!
Thank you Taffy-Waffy
';
$subst = " \1";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php