Regex - validation for string match the following characters

0 votes
added Nov 8, 2018 in Regex by LC Marshal Captain (25,790 points)
//Use regex.test() for boolean result:

/^([a-z0-9]{5,})$/.test('hello1');   // false
/^([a-z0-9]{5,})$/.test('hello12');   // true
/^([a-z0-9]{5,})$/.test('hello123');   // true

//you could remove the () from regex since there's no need to capture it. - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.