I'm unable to pass Only one test Z97 if anyone can help

Only one test case left. I’m unable to pass it.

let username = "JackOfAllTrades";
let userCheck = /(^\D)([a-zA-z]{1,})(\d*$)/i; // Change this line
let result = userCheck.test(username);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36

Challenge: Restrict Possible Usernames

Link to the challenge:

This here:

[a-zA-z]{1,}

So, you are saying that after the first char, there must be at least one char? That is why “Z97” is failing.

First of all, sites like regex101.com are a great tool for working out these things.

Secondly, I think testing this will involve a little bit of logic. You have two possibilities for what the second char is. Are you familiar with the OR operator in regex, |?

2 Likes

Yes, I’m familiar with or operator.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.