A
ast
- sent again -
hi,
let us search a.+b in string abcabcabc
var reg = /a.+b/g;
var tab = reg.exec("abcabcabc");
document.write(tab[0]);
there are 2 possible matchs:
abcab
abcabcab
javascript choose the second one. Why not. But what is the rule ?
Does javascript always provide the longest possible match ?
If i want abcab, is there something to do ?
thx
hi,
let us search a.+b in string abcabcabc
var reg = /a.+b/g;
var tab = reg.exec("abcabcabc");
document.write(tab[0]);
there are 2 possible matchs:
abcab
abcabcab
javascript choose the second one. Why not. But what is the rule ?
Does javascript always provide the longest possible match ?
If i want abcab, is there something to do ?
thx