摘要: 先看一道JavaScript题目,据说是国内某知名互联网企业的JavaScript笔试题,如果对正则的全局匹配模式不了解的话可能会对下面的输出结果感到疑惑。View Code var str = "123#abc";var re = /abc/ig;console.log(re.test(str)); //输出tureconsole.log(re.test(str)); //输出falseconsole.log(re.test(str)); //输出tureconsole.log(re.test(str)); //输出false在创建正则表达式对象时如果使用了“g”标识符或 阅读全文
posted @ 2011-04-26 23:04 rentj 阅读(2795) 评论(5) 推荐(6) 编辑