jsp源代码
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<title>利用正则表达法除去字符串中的重复字符</title>
</head>
<body>
<script language = "JavaScript">
var reg = /([.\s\S]{1})(?:\1+)/g;
var str = "aaaccbb bb cc dddd";
var newstr = str.replace(reg, '$1')
document.write(newstr);
</script>
</body>
</html>