Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
You need to check all the usernames in a database. Here are some simple rules that users have to follow when creating their username. 1) The only numbers in the username have to be at the end. There can be zero or more of them at the end. 2) Username letters can be lowercase and uppercase. 3) Usernames have to be at least two characters long. A …
let username = "JackOfAllTrades";
let userCheck = /^[a-z][a-z]+\d*$/i; // Change this line
let result = userCheck.test(username);
// Your regex should match JACK
// Your regex should not match J
// Your regex should match Oceans11
// Your regex should match RegexGuru
// Your regex should not match 007
// Your regex should not match 9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment