正则 去掉重复字符串

function delReiteration(str) {
	var reg = /(.).*?\1/g;
	while (str.match(reg) != null) {
		str = str.replace(RegExp.$1, '');
	}
	return str;
}
var str = 'abcdfdcea13241342';
alert(delReiteration(str));

posted @ 2010-10-14 19:44  zjhsd2007  阅读(297)  评论(0编辑  收藏  举报