- <html>
- <head>
- <title>利用正则表达法除去字符串中的重复字符</title>
- </head>
- <body>
- <script language="javascript"> str = "Google" str1 = str.replace(/(.).*\1/g,"$1") document.write(str + "<br>"); document.write(str1); </script>
- </body>
- </html>
服务器之家 > 正文
- <html>
- <head>
- <title>利用正则表达法除去字符串中的重复字符</title>
- </head>
- <body>
- <script language="javascript"> str = "Google" str1 = str.replace(/(.).*\1/g,"$1") document.write(str + "<br>"); document.write(str1); </script>
- </body>
- </html>