View Single Post
Old 12-09-2012, 08:35 AM   PM User | #1
BubikolRamios
Senior Coder

 
Join Date: Dec 2005
Location: Slovenia
Posts: 1,876
Thanks: 114
Thanked 76 Times in 76 Posts
BubikolRamios is on a distinguished road
regex test problem

How do you explain that ?

Code:
regexPattern = new RegExp("a","gi");
s = "a";
        alert (regexPattern.test(s));//--> true
        alert (regexPattern.test(s));//--> false
        alert (regexPattern.test(s));//--> true
        alert (regexPattern.test(s));//--> false
        //......
EDIT: if I modify each alert:
Code:
 alert (regexPattern.test(s) + s.match(regexPattern));
obviously result of
Code:
 s.match(regexPattern)
is the same on each alert.
__________________
Found a flower or bug and don't know what it is ?
agrozoo.net galery
if you don't spot search button at once, there is search form:
agrozoo.net galery search

Last edited by BubikolRamios; 12-09-2012 at 09:26 AM..
BubikolRamios is offline   Reply With Quote