Restrict Possible Usernames: Help using Regular expressions properly

On all the lessons leading up to this challenge I understood. I took notes and have been referencing. I broke the question or problem down to:
1.) !Special characters. ([^\W])
2.) (^beginning)Any A-Z || a-z && may be repeated(+) && be anywhere but the end.
3.) Can have [0-9] but only at the end($).
4.) Minimum of 2 characters and if two{2} has to be alphabet character.

I have been trying my best to problem solve this and not guess, by going through the documentation of the methods rigorously. However, I can’t solve it and feel like I’m just guessing at this point.
The closest I got was passed all parameters but 2.
I’m looking to understand so I can solve it, not just an answer to the solution.
Thanks


let username = "JackOfAllTrades";
/* The following commented out code is just a few of the many 
variations I have tried. The fails were written starting with bottom conditon up and which one I failed. */

//let userCheck = /.\w$/gi; //fail 1,3,5,6,8 from bottom up
//let userCheck = /[^\d\W$][A-Za-z-0-9]+/gi; //failed 3,5,6 from the bottom up
//let userCheck = /[\w][\D$]/gi; //failed 1,3,4,5 from bottom bottom up
//let userCheck = /^[A-Z-a-z][^0-9][0-9]$/gi; //failed 1,4,9,10,11,13 from the 
//let userCheck = /[^\W]^[^\d]/gi; //fail  2,4,9,10,11,13 from the bottom up
/*let userCheck = /[^\W]^[A-Z{2}]+^[a-z{2}][^\d{2}+][\d+]$/gi; fail 2,4,9,10,11,13 from the bottom up */

let userCheck = /^[A-Za-z][^\d\W]/gi; //failed 4,5 from the bottom up
let result = userCheck.test(username);

Challenge: Restrict Possible Usernames

Link to the challenge:

Yeah that’s a complex task.
You have to go step by step and consider chaining conditions with and/or → gonna look up the RegEx syntax for that.

This might imply a lot of trial-and-error, so make sure to add a couple of console.log() for different test-cases to speed that up.

However I don’t think you chain any conditions so far. So that won’t work because not all cases are inclusive. You can have two letters (Ae) or one letter with two numebrs (L33) → so that’s two separate cases.

Hi @Jagaya, just to clarify when you say chain conditions, I thought that was what I was doing. I just want to make sure I’m not missing something.
Thanks

“chaining conditions” means having different cases.
For example /(^[A-Za-z]|^[0-9])/ would mean “begins with a letter OR begins with a number” → the pipe-symbol (x|y) marks options for which either can be true.
The way you are currently combining statements makes it so that all have to be true at the same time. This runs into an issue for things that cannot be true at the same time, hence the “or”-conditional is needed.

Got you @Jagaya. Thanks for info.
I will keep trying. I haven’t given up, but I’ve spent a ridiculous amount of time on this. Hope I can understand if I solve it and not guess solving it.