写js正则表达式,去除字符串的首尾的逗号,怎么写????????????????????
<script language="JavaScript">
<!--
String.prototype.Trim=function(){
return this.replace(/^,*|,*$/g,'')
}
alert(",234324,".Trim())
//-->
</script>
str = str.replace(/(^\,*)|(\,*$)/g, "");
另外推荐 http://www.cnblogs.com/deerchao/archive/2006/08/24/zhengzhe30fengzhongjiaocheng.html
/^,+|,+$/g
/^.+|.*$//g