Here's my code in Chrome console:
var re = new RegExp('^(http(s)?:\/\/)?(www\.)?example.com','g');
And then I test:
re.test('example.com');
Results I get are weird.. After testing RegExp two times I get true and false after. Continuing testing same string I get rotation of true and false. While the first result is correct and it returns true , why the second returns false?