JS: Restrict Possible Usernames

the syntax for matches exactly n {n} or matches at least n {n,} have not been discussed but are required to solve this problem.

there needs to be an additional exercise either just prior to or included in this module which covers and explains these concepts before they are required to solve a problem.

That’s one way to solve the problem, but not the only one.


then /[A-Za-z][A-Za-z]\d*$/ should be listed as a solution in the Get a Hint rather than /^[a-z]{2,}\d*$/i;

That is not a solution, that one would still match if you have a number at the beginning

The Get a Hint can be written by anyone, so if you feel like it you can add a different possibile solution

/[A-Za-z][A-Za-z]\d*$/ is very much a solution.

It matches an username like 31aZA2 which is not an allowed username, numbers must be only at the end

you are wrong. but by all means, enter that regex into a javascript console and take a screenshot to prove me otherwise.

either way you are not helping this discussion.

Just so you know, with two little tweaks this regex solve the challenge without recurring to the curly brackets thing
If you want to contribute to the Get a Hint section don’t you want to do it with a correct solution?

Within challenge parameters this should test false, instead…

1 Like

and what happens with my regex when you actually use the FCC JS console. does it let you pass the test?

If you feel as strongly as you seem to, you may want to consider contributing to the github, suggestions and improvements, to code, commentary and guide are always welcome.

If I were in your shoes, I would suggest you wander over to this conversation, and add your name as an interested party.

I would caution, however, that being deliberately abrasive won’t further your cause.


There is a wide range of regex expressions that would pass the tests without respecting challenge parameters, the tests can’t consider each situation
I would still consider that as wrong, because if in your job you will find yourself with a precise description of what you should test for and a few examples of what could and could not be acceptable, and you create something that do the right thing with the examples but doesn’t respect the given parameters you wouldn’t have completed your task


Please be careful to check that what you’re saying is actually correct before being abrasive toward other forum members, ieahleen was just [correctly] pointing out a possible issue with your code.


snowmonkey, i’ve seen you helping a lot of people on this site including some valuable suggestions on my projects when i’ve asked for feedback. with that said, you haven’t even posted a response to the link you suggested while my name is the first poster.

The text for the topic of this forum category is as follows: Report any problems you’re having with freecodecamp.org here, and we’ll try and fix them.

It does not read, post a problem and a group of people will tell you off and to fix said problems yourself. Being direct is not the same as deliberately abrasive so we can skip the ‘I caution you’ and ‘be careful’. It took several iterations before the poster vaguely recognized that indeed the solution i posted passes FCC’s test while being incorrect and the hint is completely divided from the content covered, but has become so firmly entrenched on proving me wrong they have completely overlooked a genuine support issue being raised…

of which I’ve pointed out two:

the first being the inconsistency between the hints provided for a given challenge. without some kind of system of proof in place anyone can add anything even if it contradicts said challenge or further confuses the student. this is further enforced by community answers in a support forum such as, “if don’t like it change it yourself” that don’t enforce a standard or respect for the newcomer coder. What if I don’t have the time to “fix it myself”? Does that mean the genuine issue addressed will remain ignored?

the second point being some challenges allow incorrect answers to pass.

I might have had more sympathy if i posted this in a help forum or the javascript forum.

What if I don’t have the time to “fix it myself”? Does that mean the genuine issue addressed will remain ignored?

It does not. Early on, I found quite a few issues, and submitted bug reports on the FCC github page. Some were valid, and some were my misunderstanding. Part of the process of becoming a developer is learning effective use of bug-squashing tools, such as the git reporting system. Not saying you did or did not use them, not commenting on that at all, simply saying, for those who do not have the time to fix the issue themselves, there is a viable alternative.

And you’re absolutely right, as you say you are the first responder on that conversation I’d mentioned and I am not even on the list – but then, you aren’t really aware of side conversations that may be going on, and you seemed to be looking for alternatives to correct the curriculum. Whether I have posted on that conversation or not does not in any way lessen the value of joining into that endeavor.

If you feel you have been told off by anyone here, then please let me extend a personal apology. It was never my intent to make you feel in any way wronged or challenged. If anything, I tried to suggest a constructive way to make the very changes you were suggesting.

That said, when the day comes that you work in a team, how well you can work with that team will play into your effectiveness as a member of that team.

1 Like

the above should NOT be listed as a solution, as it is not a solution. It is saying “a string that ends with exactly two letters and zero or more digits”. Does not, in fact, meet the regex requirement.

  1. The only numbers in the username have to be at the end. There can be zero or more of them at the end.

Thus, had your solution included the opening caret: /^[A-Za-z][A-Za-z]\d*$/, it might have been more “complete” and likely to solve that problem.

There are multiple solutions to every problem, but some are more complete than others. Generally, there are at most three hint solutions given: beginner, intermediate and advanced (where it applies). If a solution is close to an existing solution, it is considered redundant.

The other thing to consider is, the curriculum is by no means comprehensive. There are hints (in the hints) for further research and self-study. But that is part of what is being considered with the new curriculum rollout.

You asked me to show it was wrong, I did not become so firmly entrenched of proving you wrong…
This is what you said, this I did:

Yes. And when you finally tried the solution in FCC you could only show me it worked (read: a solution) even though it shouldn’t have.

Which is why I brought it up in the first place.

In the support section, which is a place to report any problems.

And a solution that should not work but does and a challenge hint that addresses uncovered topics as part of the solution sounds like a problem. But instead of focusing on those issues you insisted to overlook them to tell me my regex was incorrect.

Do you get it now. Of course I knew it was incorrect.

Please understand that it is very difficult to infer tone in a response on a forum, particularly slight sarcasm.


This does not read as “I know this solution is wrong but it passes the tests on the challenge, this is an issue”. Keeping in mind your original post, which says

What your second post (seemingly unequivocally) reads as is “I think this should be added as a solution”. As a result, you being questioned on the validity of the solution is perfectly reasonable. You writing this:

Is not you being direct: you know the solution is incorrect, you just neglected to tell anyone that that what you were talking about specifically was that it would pass the FCC tests. If you do what you say, as the person you replied to did, the code returns true for things that should not be true.

You did not provide that information at all until later in the conversation, and there was no way to infer it from what you wrote. Please understand, it may be very clear to you, but no-one else can infer that information without you actually telling us.


Comment made before doing research…

Comment made after doing research…

Please understand making claims prior to doing research does not contribute to productive discussion.

The “claims” are absolutely correct: you are both right. But we had no way of knowing the specific thing you were talking about, because didn’t say and there was no way to infer it. Please do not be so dismissive, what you meant may have been very clear to you but it was not to people reading your posts.

1 Like