摘要: 原文链接:https://blog.csdn.net/qq_20025577/article/details/85059762 阅读全文
posted @ 2019-08-06 21:38 study_php_java_C++ 阅读(593) 评论(0) 推荐(0) 编辑
摘要: js代码: 问题原因: 这是因为正则reg的g属性,设置的全局匹配。RegExp有一个lastIndex属性,来保存索引开始位置。 上面的问题,第一次调用的lastIndex值为0,到了第二次调用就不是0了 解决方案 第一种方案是将g去掉,关闭全局匹配。 第二种就是在每次匹配之前将lastIndex 阅读全文
posted @ 2019-08-06 16:32 study_php_java_C++ 阅读(280) 评论(0) 推荐(0) 编辑