2.5 KiB
2.5 KiB
id, title, challengeType, forumTopicId
id | title | challengeType | forumTopicId |
---|---|---|---|
587d7db8367417b2b2512ba2 | Restrict Possible Usernames | 1 | 301363 |
Description
Instructions
userCheck
to fit the constraints listed above.
Tests
tests:
- text: Your regex should match <code>JACK</code>
testString: assert(userCheck.test("JACK"));
- text: Your regex should not match <code>J</code>
testString: assert(!userCheck.test("J"));
- text: Your regex should match <code>Jo</code>
testString: assert(userCheck.test("Jo"));
- text: Your regex should match <code>Oceans11</code>
testString: assert(userCheck.test("Oceans11"));
- text: Your regex should match <code>RegexGuru</code>
testString: assert(userCheck.test("RegexGuru"));
- text: Your regex should not match <code>007</code>
testString: assert(!userCheck.test("007"));
- text: Your regex should not match <code>9</code>
testString: assert(!userCheck.test("9"));
- text: Your regex should not match <code>A1</code>
testString: assert(!userCheck.test("A1"));
- text: Your regex should not match <code>BadUs3rnam3</code>
testString: assert(!userCheck.test("BadUs3rnam3"));
- text: Your regex should match <code>Z97</code>
testString: assert(userCheck.test("Z97"));
- text: Your regex should not match <code>c57bT3</code>
testString: assert(!userCheck.test("c57bT3"));
Challenge Seed
let username = "JackOfAllTrades";
let userCheck = /change/; // Change this line
let result = userCheck.test(username);
Solution
let username = "JackOfAllTrades";
const userCheck = /^[a-z]([0-9]{2,}|[a-z]+\d*)$/i;
let result = userCheck.test(username);