hi, thanks for the code. i tried. it only worked if the string is simply the one i wanna convert. but that particular string is in the middle of a long text, and there are multiple occurance, it won't.
however, i did manage to come up with this code that worked. but i believe it can be improved on. it will identify all occurance of the specified pattern and do the necessary replacement throughout the whole string. preg_match_all("|\[::(.*)::\]|U", $longTxt, $matchedResult); for ($idx = 0; $idx < count($matchedResult[1]); $idx++) { $extract = stripslashes($matchedResult[1][$idx]); $longTxt = str_replace("[::{$matchedResult[1][$idx]}::]", "\".$extract.\"", $longTxt); } lance Analysis & Solutions wrote: > Lance: > > On Fri, Jun 14, 2002 at 11:41:34PM +0800, Lance wrote: > >>[::word1 \" word2 \" word3::] >>to: >>".word1 " word2 " word3." > > > While I don't know if this is really what you need, it does do exactly > what you want to do in your example: > > $Replace['\\'] = ''; > $Replace['::'] = '.'; > $Replace['['] = ''; > $Replace[']'] = ''; > > $UserInput = '[::word1 \" word2 \" word3::]'; > > echo strtr($UserInput, $Replace); > > --Dan > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php