strip out repeated ocurrence of a string
| From: | Camilo Sperberg | Date: | Tue, 26 Jan 2010 03:48:46 +0000 |
| Subject: | strip out repeated ocurrence of a string | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-301449@lists.php.net to get a copy of this message | ||
Hello list :)
I have this problem, a certain string can contain the following information:
$string = '
hi{value1;value2}
bye{value1;value3}
hi{value1;value4}
hi{value1;value2}
bye{value1;value2}
';
What I want is to be able to get this result:
$string = '
hi{value1;value2}
bye{value1;value3}
hi{value1;value4}
bye{value1;value2}
';
(the order of appearance doesn't matter)
Is it even possible to do this with regular expresions? Or should I first
look if there is some kind of match and then apply an
str_replace($match,'',$string) and add the $match again?
Greetings !
--
Mailed by:
UnReAl4U - unreal4u
ICQ #: 54472056
www1: http://www.chw.net/
www2: http://unreal4u.com/