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>.........
or
ceo@facekut.com ,creative.rahul007@gmail.com.........

I would be very thankful if anyone has answer.

Thanks

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)
		{
			if($key==0)
				$email[]=$each;
		}
	}
	print_r($email);
	
	
?>
commented: Vibha is exceptionally excellent. +2

Hi
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.