日期:2014-05-16 浏览次数:20406 次
alert('A1000000 A2000000 '.replace(/\s+(?=$
------解决方案--------------------
[a-z]\d{7})/ig,''));
<script>
function delHtmlTag(str)
{
var str=str.replace(/<\/?[^>]*>/gim,"");//去掉所有的html标记
var result=str.replace(/(^\s+)
------解决方案--------------------
(\s+$)/g,"");//去掉前后空格
return result.replace(/\s/g,"");//去除文章中间空格
}
</script>
alert('A1000001 aafdfk23d4ajfasdf A1000002 kfgksdfgksdfg A0000003 w345345sfsdg8888'.replace(/([a-z]\d{7})\s+/ig,'$1'));
var s = "A1000001 aafdfk23d4ajfasdf A1000002 kfgksdfgksdfg A0000003 w345345sfsdg8888";
alert(s.replace(/([a-z]\d{7})\s+/ig,"$1"));