hey guys

I have a string containing email addresses like

"ceo@facekut.com" <ceo@facekut.com>,"Rahul Mahajan" <creative.rahul007@gmail.com>.........

Now is there a way in php to remove all the things between quotes "..." and make this
look like below?

ceo@facekut.com ,creative.rahul007@gmail.com.........

I would be very thankful if anyone has answer.


Recommended Answers

All 3 Replies

This code return array of emails.

	$str = '"ceo@facekut.com" <ceo@facekut.com>,"Rahul Mahajan" <creative.rahul007@gmail.com>';
	$pattern = '/<([^"]*)>/';
	preg_match_all($pattern, $str, $matches, PREG_OFFSET_CAPTURE, 3);	
	foreach($matches[1] as $val)
		foreach($val as $key=>$each)
commented: Vibha is exceptionally excellent. +2

Thanks for your kind help, It worked superb for me, and my problem which was continue from long time is solved now.

Thanks again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.