question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Able to pass Restrict Possible Usernames with incorrect code

See original GitHub issue

This is the Regex challenge --> https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames

The specification of the code you will write is:

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

Yet it never actually checks for it, meaning you could cheat with the code below:

let username = "JackOfAllTrades";
let userCheck = /\w[a-z]/gi; // Change this line
let result = userCheck.test(username);

–> https://repl.it/@John_Nicole/Regular-Expressions-17761

If you actually tested for that, a username like 1JackOfAllTrades would fail this regex.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
joshallingcommented, Nov 6, 2018

@TomerPacific Yeah, feel free to submit a PR for this.

0reactions
moT01commented, Dec 11, 2018

Closing in favor of the duplicate mentioned

Read more comments on GitHub >

github_iconTop Results From Across the Web

Restrict Possible Usernames - Free Code Camp - YouTube
In this regular expressions tutorial we -TITLE-. We're using regular expressions in conjunction with JavaScript methods.
Read more >
freeCodeCamp Regular Expression, Restrict Possible ...
freeCodeCamp Regular Expression, Restrict Possible Usernames, ... beginner make sure to check out our course tutorials here at We Will Code !
Read more >
RegEx Restrict Possible Usernames - JavaScript
Tell us what's happening: how to make usernames like ja4ck, du76de, or son495ja returns false/invalid? one of the rules is number characters ...
Read more >
javascript - Regular Expressions | Restrict Possible Usernames
Solution 1: let username = "JackOfAllTrades"; let userCheck = /^[a-z]([0-9][0-9]+|[a-z]+\d*)$/i; let result = userCheck.test(username);.
Read more >
Set Password Policies - Salesforce Help
A password can't contain a user's username and can't match a user's first or last name. Passwords also can't be too simple. For...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found