There's a silver lining in everything.

After Walgreens Boots Alliance (WBA) - Get Report announced Thursday morning that it terminated its merger with Rite Aid Corp. (RAD) - Get Report amid regulatory concerns, Wall Street started to ponder the idea of e-commerce giant Inc. (AMZN) - Get Report making a bid for the cast-aside drugstore retailer.

"I don't think Amazon will be interested [in entering the pharmacy space] in the near future," said Stefano Pessina, Walgreens Boots Alliance executive vice chairman and CEO, in response to an analyst's question on a company earnings call.

But, if he's wrong, Pessina said Walgreens would not rule out partnering with Amazon.

"I believe at the end of the day, we could find our role in the new environment," Pessina said. "Let's say I see everything as an opportunity."

Of course, Amazon is going to be plenty busy finalizing its $13.7 billion acquisition of organic grocer Whole Foods Market Inc. (WFM) , but reports have recently surfaced that the e-tailer is trying to break into the pharmacy space. Analysts have questioned whether Amazon may try to acquire Rite Aid or even Express Scripts Holding Co. (ESRX) .

Today, Walgreens said instead of merging with Rite Aid, it will buy half of Rite Aid's stores, totaling 2,186, for $5.175 billion in cash. The deal leaves Walgreens with more than 15,000 stores and Rite Aid with 2,300.

While largely overshadowed by the announcement of the new deal, Walgreens Boots Alliance did report third-quarter earnings this morning, too. The company posted earnings of $1.33 a share on revenue of $30.1 billion, beating Wall Street's estimates for earnings of $1.30 a share on revenue of $29.7 billion.

Shares Rite Aid fell 28% to $2.83 early Thursday afternoon. Walgreens' were up 0.3% to $77.35.

Walgreens Boots Alliance is a holding in Jim Cramer's Action Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells WBA? Learn more now.

Read More Trending Articles:

  • Painful Day for Nasdaq as Tech Torpedoes Wall Street Deep Into the Red
  • 5 of the Worst Cruise Ships According to the CDC's Sanitary Inspection List
  • Walgreens and Rite-Aid Just Laughed in the Face of Regulators, Strike One Clever New Deal
  • Here's Why Amazon Could Feast on the Remaining Carcass of Rite Aid After Failed Walgreens Merger
  • Walgreens Punches One of Its Biggest Rivals in the Face With This Surprising New Deal