Question: how to check if a string matches a regex in javascript?
Answer: console.log(/^([a-z0-9]{4,})$/.test('ab1')); // false console.log(/^([a-z0-9]{4,})$/.test('ab123')); // true console.log(/^([a-z0-9]{4,})$/.test('ab1234')); // true. ... 
var str = 'abc123'; if (str.