var title ="字符串zifuchuan"
var reg=/[\u4E00-\u9FA5]/g
var result=title.replace(reg,'')
alert(result)
</script>
var str = 'I come from Italy, but I like 中国'var reg = /[\u4e00-\u9fa5]/g
str = str.replace(reg, "")
我用javascript 写了个例子,你参考一下:<script language="javascript">
function check()
{
var strInput=document.all.form1.text1.value
var keyword = "apple"
var n = strInput.indexOf(keyword)
if(n!=-1)
{
var str_array =strInput.split(keyword)
var strStar =""
for(var i=0i<keyword.lengthi++)
{
strStar+="*"
}
strOutPut =str_array[0]+strStar+str_array[1]
}else
{
strOutPut = strInput
}
document.all.maintbl.rows(0).cells(0).innerText = strOutPut
}
</script>
<form name =form1 >
<input type=text size=30 name =text1 />
<input type =button onClick="check()" value ="显示">
</form>
<table id =maintbl>
<tr><td ></td></tr>
</table>