定位一个字符串中,匹配与定位重复字符中的最后一个字符:
例子:
<script type="text/javascript"> var str="http://www.cnblogs.com/cn-coder//img.ipg"; var patt1 = /\/\/(?!.*\/\/)/ig; document.write(str.replace(patt1,"/"));//http://www.cnblogs.com/cn-coder/img.ipg </script>
时间: 2024-10-12 07:59:07