如何删除除逗号(,),冒号(:),双引号(“)和字符串PHP的花括号之外的所有特殊字符和空格

How can i clean this JSON String data ?. At first look it is very easy using str_replace method but its not. This JSON string is form JSON object that has spaces for ex . {" First Name ": "something"} . so when i converted this into json string the empty spaces replaced by unwanted strings(\u00a0) . I think this problem can be solve using preg_replace but the suddenly i dont know the regex for comma,double quote,colon. This characters is necessary for json string format. Please help me.

for example

       {"AS_applicant_Data__c":
            "{
                \"Last Name\u00a0\":\"SDFSAD\",
                \"First Name\u00a0\":\"SDFAFSDA\",
                \"Middle Name\u00a0\":\"SAFDSAFD\",
                \"Gender\u00a0\":\"Male\"
            }"
        }

to

        {"AS_applicant_Data__c":"
            "{
                "Last Name":"SDFSAD",
                "First Name":"SDFAFSDA",
                "Middle Name":"SAFDSAFD",
                "Gender":"Male"
            }"
        }

I use this code and it looks ok to me:

<?php

$string = <<<EOD
{"AS_applicant_Data__c":
    "{
        \"Last Name\u00a0\":\"SDFSAD\",
        \"First Name\u00a0\":\"SDFAFSDA\",
        \"Middle Name\u00a0\":\"SAFDSAFD\",
        \"Gender\u00a0\":\"Male\"
    }"
}
EOD;
$pattern = '#\\\\u[0-9a-f]{4}#i';
$replacement = '';
echo preg_replace($pattern, $replacement, $string);

?>

This regular expression is blindly replace Unicode char in a format of \uxxxx with empty string. If you know for certain that there's only \u00a0, you can change regex to #\\\\u00a0#i

Try a quick run here: http://ideone.com/xW4zTN

When i use this preg_replace("/[^a-zA-Z]/", "", $str); .. it will remove all the special characters. is it possible to skip the comma,double quotes,curly braces and colon ?

Of course it is, just include those special characters in the character class (the quotation mark has to be escaped with a backslash):

preg_replace("/[^a-zA-Z,\"{}:]/", "", $str);