正则式不解!帮着给各说法!100分敬上!
var reg = /hello\w*/ig;
var txt = "HelloNirvanahelloworldhello";
alert(txt.match(reg));
这样只能匹配出HelloNirvanahelloworldhello,
但我认为是HelloNirvanahelloworldhello,helloworldhello,hello三个
为什么呢?
可是匹配txt.match(/hello/ig);就是Hello,hello,hello
这个为什么呢?给我讲讲明白!