Restrict Possible Usernames: Question about solution

Tell us what’s happening:
Hi there, anybody can tell me what part of this code fulfills that “…A two-character username can only use alphabet letters as characters.”?

Your code so far

let username = "JackOfAllTrades";
let userCheck = /^[a-z][a-z]+\d*$|^[a-z]\d\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/85.0.4183.121 Safari/537.36.

Challenge: Restrict Possible Usernames

Link to the challenge:

Welcome, David.

This part:

  • ^ the start of the text (line)…
  • [a-z] must be a letter…
  • [a-z] followed by a letter + one or more times

Hope this helps

1 Like