I have asked this before but cant find a response/answer to the same.
I do have tags like this..
news,门户,æ–°é—»,portal,网易,163,china,门户ç
I need to extract only news,portal,163,china
from above. how can I do it in php??
I have asked this before but cant find a response/answer to the same.
I do have tags like this..
news,门户,æ–°é—»,portal,网易,163,china,门户ç
I need to extract only news,portal,163,china
from above. how can I do it in php??
Assuming you want to keep only ascii alpha-numeric parts of this string, the following code will work:
$str = explode(',', $str);
$str = preg_grep('#^[[:alnum:]]+$#', $str);
$str = implode(',', $str);
This one too:
$str = preg_replace('#(^([^[:alnum:],]+,)+|,[^[:alnum:],]+)#', '', $str);
Which both return news,portal,163,china