Alternate Solution to RegExp Problem?

Alternate Solution to RegExp Problem?
0

I think this is also another valid solution to the challenge, and doesn’t need the starting ^.

let username = "JackOfAllTrades";
let userCheck = /([a-z])([a-z]+|[0-9][0-9]+)$[0-9]*/i; // Change this line
let result = userCheck.test(username);

Challenge:

If you don’t specify starting ^ you don’t check the start of the string:

userCheck.test('0a00');
userCheck.test('[email protected]#$%arjunnnij');
// etc...

So it’s not a valid solution, it’s a valid hack of insufficient tests

1 Like

Got it, thanks for the example!