I have detect a strange behavior in regexps created with the RegExp object:
With this code:
var exp1 = /./;
var exp2 = new RegExp('.');
var test1 = exp1.test('large\n\ntext..etc.');
var test2 = exp2.test('large\n\ntext..etc.');
var match1 = 'large\n\ntext..etc.'.match(exp1);
var match2 = 'large\n\ntext..etc.'.match(exp2);
...the result is:
test1 = true
test2 = true
match1 = 'l' (first match)
match2 = null
With the regexp maked with the regexp object from a string it finds nothing...
Why does this happends?
Thanks!!
EDIT: I have tried it in Mozilla Firefox 3.5, I haven't tried in other browsers...