Matthew Perry has no problem making “Friends,” but he can’t seem to hold onto a girlfriend!

Perry flipped for “Legally Blonde” star Selma Blair after she guest-starred on his hit NBC sitcom recently — then was let down hard when Selma made it clear she was standing by her longtime love, musician/actor Jason Schwartzman.

“Matt’s just not lucky in love,” a source told The ENQUIRER.

Selma, 30, was with 33-year-old Matthew recently when he was involved in a car accident in his silver BMW while driving in Hollywood. They weren’t hurt, and The ENQUIRER got exclusive photos of Matt exchanging insurance information with the elderly driver involved in the collision.

Matthew and Selma became such good pals that they were spotted four weekends in a row at a Los Angeles restaurant.

But Selma and Jason — son of “Rocky” star Talia Shire — have been a couple for more than two years, and their love is as strong as ever. “Jason and Selma hooked up for coffee at The Coffee Bean on Sunset in West Hollywood on December 17,” an eyewitness told The ENQUIRER.

“They talked for a while and had coffee, then left to take tennis lessons together at the Mulholland Tennis Club.

“When they left The Coffee Bean, they were all over each other, kissing and hugging. They’re obviously very much in love.”

That’s bad news for Matt, said the source. “Matt loved hanging out with Selma — and she loves being with him.

“Matt’s charming and funny, and most women in Hollywood consider him a real catch.

“But things just don’t work out.

“He’s been out with dozens of beautiful women over the past 10 years, including Julia Roberts and Neve Campbell.

“But he’s always catching these women at the wrong time.

“He’s learned not to invest too much of his heart in a woman because he’s been burned so often. But he’s still a softie — and the rejection hurts.”

Matthew has dated Yasmine Bleeth, Liz Hurley, Krista Allen, Renee Ashton, Jennifer Capriati, Amanda Peet and Jamie Tarses, among a gaggle of other fabulous women.

“Women love Matt — there’s never been one who dated him who didn’t gush about how funny and wonderful he is,” the source said.

“But timing is everything in love — and Matt’s timing couldn’t be worse.

“He’s smitten with Selma, but she’s head over heels for Jason. They’ve even been talking marriage, though they’ve put it off for their careers’ sake.

“Selma spent hours together with Matt gushing on and on about Jason — and Matt finally got the message. He didn’t like it, but he got it.

“To him, it’s another case of ‘the one that got away.'”