Why is this regex not working properly ?
new RegExp(/[a-z\d]/g).test('5');
The result is sometimes true and other time false. It keeps toggling between true/false
var regx = new RegExp(/[a-z\d]/g);
console.log(regx.test('5')) // true
console.log(regx.test('5')) // false
console.log(regx.test('5')) // true
console.log(regx.test('5')) // false