kamkam
03-14-2009, 05:19 AM
Hi;
i want to have a result like the follwoing by using regular expression
"锕=錒','锿=鎄','皑=皚','嗳=噯','蔼=藹','霭=靄','爱=愛','嫒=嬡";
but my code give me not right result, could anyone help, thanks
"锕=錒 锿=鎄 皑=皚 嗳=噯 蔼=藹 霭=靄 爱=愛 嫒=嬡";
<?php
$string = "锕=錒 锿=鎄 皑=皚 嗳=噯 蔼=藹 霭=靄 爱=愛 嫒=嬡";
$pattern = '/(\s)+/u';
$replacement = '\',\'';
echo preg_replace($pattern, $replacement, $string);
?>
i want to have a result like the follwoing by using regular expression
"锕=錒','锿=鎄','皑=皚','嗳=噯','蔼=藹','霭=靄','爱=愛','嫒=嬡";
but my code give me not right result, could anyone help, thanks
"锕=錒 锿=鎄 皑=皚 嗳=噯 蔼=藹 霭=靄 爱=愛 嫒=嬡";
<?php
$string = "锕=錒 锿=鎄 皑=皚 嗳=噯 蔼=藹 霭=靄 爱=愛 嫒=嬡";
$pattern = '/(\s)+/u';
$replacement = '\',\'';
echo preg_replace($pattern, $replacement, $string);
?>