PHPの正規表現で全角文字を置き換える方法
PHPコード:
function zo_replace(text) {
return text && text.replace(/[\u3000\uff01-\uff5f]/g, function($0) {
return $0 == “\u3000″ ? " " : String.fromCharCode($0.charCodeAt(0) – 0xfee0);
});
}
Coding Changes the World
PHPコード:
function zo_replace(text) {
return text && text.replace(/[\u3000\uff01-\uff5f]/g, function($0) {
return $0 == “\u3000″ ? " " : String.fromCharCode($0.charCodeAt(0) – 0xfee0);
});
}